Skip to content

Commit 68266bd

Browse files
basuamdJiri Kosina
authored andcommitted
HID: amd_sfh: Handle condition of "no sensors" for SFH1.1
Based on num_hid_devices, each sensor device registers to HID. If "no sensors" then amd_sfh work initialization and scheduling doesn’t make sense and return ENODEV to stop driver probe. Hence add a check for num_hid_devices to handle special case in the situation of "no sensors" for SFH1.1. Fixes: 93ce5e0 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent beb18bb commit 68266bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
110110
amd_sfh1_1_set_desc_ops(mp2_ops);
111111

112112
cl_data->num_hid_devices = amd_sfh_get_sensor_num(privdata, &cl_data->sensor_idx[0]);
113+
if (cl_data->num_hid_devices == 0)
114+
return -ENODEV;
113115

114116
INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work);
115117
INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer);

0 commit comments

Comments
 (0)