summaryrefslogtreecommitdiffstats
path: root/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
diff options
context:
space:
mode:
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>2022-07-12 20:18:26 +0200
committerJiri Kosina <jkosina@suse.cz>2022-07-21 13:43:58 +0200
commit06aa2a43c307cf4096f422dcb575e5d2913e528f (patch)
treeca3c89797439f671063bfd32c444128788f45db4 /drivers/hid/amd-sfh-hid/amd_sfh_hid.c
parentMerge tag 'for-linus-2022052401' of git://git.kernel.org/pub/scm/linux/kernel... (diff)
downloadlinux-06aa2a43c307cf4096f422dcb575e5d2913e528f.tar.xz
linux-06aa2a43c307cf4096f422dcb575e5d2913e528f.zip
HID: amd_sfh: Add NULL check for hid device
On removal of hid device during SFH set report may cause NULL pointer exception. Hence add NULL check for hid device before accessing. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/amd-sfh-hid/amd_sfh_hid.c')
-rw-r--r--drivers/hid/amd-sfh-hid/amd_sfh_hid.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
index 1089134030b0..1b18291fc5af 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
@@ -101,11 +101,15 @@ static int amdtp_wait_for_response(struct hid_device *hid)
void amdtp_hid_wakeup(struct hid_device *hid)
{
- struct amdtp_hid_data *hid_data = hid->driver_data;
- struct amdtp_cl_data *cli_data = hid_data->cli_data;
+ struct amdtp_hid_data *hid_data;
+ struct amdtp_cl_data *cli_data;
- cli_data->request_done[cli_data->cur_hid_dev] = true;
- wake_up_interruptible(&hid_data->hid_wait);
+ if (hid) {
+ hid_data = hid->driver_data;
+ cli_data = hid_data->cli_data;
+ cli_data->request_done[cli_data->cur_hid_dev] = true;
+ wake_up_interruptible(&hid_data->hid_wait);
+ }
}
static struct hid_ll_driver amdtp_hid_ll_driver = {