diff options
Diffstat (limited to 'drivers/hid/hid-cougar.c')
| -rw-r--r-- | drivers/hid/hid-cougar.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hid/hid-cougar.c b/drivers/hid/hid-cougar.c index 28d671c5e0ca..5596dd940322 100644 --- a/drivers/hid/hid-cougar.c +++ b/drivers/hid/hid-cougar.c @@ -103,10 +103,10 @@ static void cougar_fix_g6_mapping(void) /* * Constant-friendly rdesc fixup for mouse interface */ -static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static const __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) { - if (rdesc[2] == 0x09 && rdesc[3] == 0x02 && + if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 && (rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) { hid_info(hdev, "usage count exceeds max: fixing up report descriptor\n"); @@ -179,10 +179,9 @@ static int cougar_bind_shared_data(struct hid_device *hdev, cougar->shared = shared; - error = devm_add_action(&hdev->dev, cougar_remove_shared_data, cougar); + error = devm_add_action_or_reset(&hdev->dev, cougar_remove_shared_data, cougar); if (error) { mutex_unlock(&cougar_udev_list_lock); - cougar_remove_shared_data(cougar); return error; } |
