diff mbox series

[v3] HID: logitech-dj: Fix mouse detection

Message ID 20190725141949.9737-1-lionel.g.landwerlin@intel.com (mailing list archive)
State Rejected
Delegated to: Jiri Kosina
Headers show
Series [v3] HID: logitech-dj: Fix mouse detection | expand

Commit Message

Lionel Landwerlin July 25, 2019, 2:19 p.m. UTC
Now logi_dj_recv_query_paired_devices() will return a positive value
while success, but logi_dj_probe expect zero in case of success, so
set it to 0 before return.

Fixes this error :

   logitech-djreceiver: probe of 0003:046D:C534.0006 failed with error 7

Also prevents the pluging of the mouse dongle in/out to hang the
system.

v2: Drop useless retval = 0 (YueHaibing)

v3: Add explanation (YueHaibing)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: linux-input@vger.kernel.org
Cc: yuehaibing@huawei.com
Cc: hdegoede@redhat.com
Cc: benjamin.tissoires@redhat.com
Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices")
Reviewed-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/hid/hid-logitech-dj.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Hans de Goede July 29, 2019, 3:47 p.m. UTC | #1
Hi,

Thank you for tracking down the cause of this and for
providing an initial patch fixing this.

On 25-07-19 16:19, Lionel Landwerlin wrote:
> Now logi_dj_recv_query_paired_devices() will return a positive value
> while success, but logi_dj_probe expect zero in case of success, so
> set it to 0 before return.
> 
> Fixes this error :
> 
>     logitech-djreceiver: probe of 0003:046D:C534.0006 failed with error 7
> 
> Also prevents the pluging of the mouse dongle in/out to hang the
> system.
> 
> v2: Drop useless retval = 0 (YueHaibing)
> 
> v3: Add explanation (YueHaibing)
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: linux-input@vger.kernel.org
> Cc: yuehaibing@huawei.com
> Cc: hdegoede@redhat.com
> Cc: benjamin.tissoires@redhat.com
> Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices")
> Reviewed-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   drivers/hid/hid-logitech-dj.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
> index 6196217a7d93..8cdf37309ada 100644
> --- a/drivers/hid/hid-logitech-dj.c
> +++ b/drivers/hid/hid-logitech-dj.c
> @@ -1736,6 +1736,7 @@ static int logi_dj_probe(struct hid_device *hdev,
>   				__func__, retval);
>   			goto logi_dj_recv_query_paired_devices_failed;
>   		}
> +		retval = 0;
>   	}
>   
>   	return retval;

You are now overriding the return value with 0, even if it is an error,
effectively undoing the result of commit dbcbabf7da92, except that an
error will no be logged (but other then the logging nothing will change).

I've just hit the issue caused by this myself after upgrading to 5.3-rc2
myself. I've prepared a fix which properly fixes this by making
logi_dj_recv_query_hidpp_device either return the negative error returned
by hid_hw_raw_request or 0 when hid_hw_raw_request succeeded.

I will put you in the Cc of the patch fixing for this.

Regards,

Hans
diff mbox series

Patch

diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 6196217a7d93..8cdf37309ada 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -1736,6 +1736,7 @@  static int logi_dj_probe(struct hid_device *hdev,
 				__func__, retval);
 			goto logi_dj_recv_query_paired_devices_failed;
 		}
+		retval = 0;
 	}
 
 	return retval;