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: 4b2c53d93a ("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>
This commit is contained in:
Basavaraj Natikar 2022-07-12 23:48:26 +05:30 committed by Jiri Kosina
parent aa051d36ce
commit 06aa2a43c3

View File

@ -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 = {