Skip to content

Commit

Permalink
HID: logitech-dj: Really fix return value of logi_dj_recv_query_hidpp…
Browse files Browse the repository at this point in the history
…_devices

Commit dbcbabf ("HID: logitech-dj: fix return value of
logi_dj_recv_query_hidpp_devices") made logi_dj_recv_query_hidpp_devices
return the return value of hid_hw_raw_request instead of unconditionally
returning 0.

But hid_hw_raw_request returns the report-size on a successful request
(and a negative error-code on failure) where as the callers of
logi_dj_recv_query_hidpp_devices expect a 0 return on success.

This commit fixes things so that either the negative error gets returned
or 0 on success, fixing HID++ receivers such as the Logitech nano receivers
no longer working.

Cc: YueHaibing <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Lionel Landwerlin <[email protected]>
Fixes: dbcbabf ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices")
Reported-by: Lionel Landwerlin <[email protected]>
Reported-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Tested-by: Rafael J. Wysocki <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Tested-by: Petr Vorel <[email protected]>
Reviewed-by: YueHaibing <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
jwrdegoede authored and Jiri Kosina committed Aug 5, 2019
1 parent 65f11c7 commit 6fb08f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-logitech-dj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ static int logi_dj_recv_query_hidpp_devices(struct dj_receiver_dev *djrcv_dev)
HID_REQ_SET_REPORT);

kfree(hidpp_report);
return retval;
return (retval < 0) ? retval : 0;
}

static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
Expand Down

0 comments on commit 6fb08f1

Please sign in to comment.