Message ID | 20190729155036.4094-1-hdegoede@redhat.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 6fb08f1a5f7e5cdde1ce00104788e602f4299b99 |
Delegated to: | Jiri Kosina |
Headers | show |
Series | [5.3,regression,fix] HID: logitech-dj: Really fix return value of logi_dj_recv_query_hidpp_devices | expand |
On Monday, July 29, 2019 5:50:36 PM CEST Hans de Goede wrote: > Commit dbcbabf7da92 ("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 <yuehaibing@huawei.com> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices") > Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Reported-by: Rafael J. Wysocki <rjw@rjwysocki.net> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> This helps here, thanks! Tested-by: Rafael J. Wysocki <rjw@rjwysocki.net> > --- > drivers/hid/hid-logitech-dj.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c > index 6196217a7d93..b7c3edf21235 100644 > --- a/drivers/hid/hid-logitech-dj.c > +++ b/drivers/hid/hid-logitech-dj.c > @@ -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) >
Hi, > Commit dbcbabf7da92 ("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 <yuehaibing@huawei.com> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices") > Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Reported-by: Rafael J. Wysocki <rjw@rjwysocki.net> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > Tested-by: Rafael J. Wysocki <rjw@rjwysocki.net> Reviewed-by: Petr Vorel <pvorel@suse.cz> Tested-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr
On 2019/7/29 23:50, Hans de Goede wrote: > Commit dbcbabf7da92 ("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 <yuehaibing@huawei.com> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices") > Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Reported-by: Rafael J. Wysocki <rjw@rjwysocki.net> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > drivers/hid/hid-logitech-dj.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c > index 6196217a7d93..b7c3edf21235 100644 > --- a/drivers/hid/hid-logitech-dj.c > +++ b/drivers/hid/hid-logitech-dj.c > @@ -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) > Reviewed-by: YueHaibing <yuehaibing@huawei.com>
On Mon, 29 Jul 2019, Hans de Goede wrote: > Commit dbcbabf7da92 ("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 <yuehaibing@huawei.com> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices") > Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Reported-by: Rafael J. Wysocki <rjw@rjwysocki.net> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > drivers/hid/hid-logitech-dj.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c > index 6196217a7d93..b7c3edf21235 100644 > --- a/drivers/hid/hid-logitech-dj.c > +++ b/drivers/hid/hid-logitech-dj.c > @@ -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; > } > Applied to for-5.3/upstream-fixes; I will be sending it to Linus in a couple days. Thanks,
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 6196217a7d93..b7c3edf21235 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -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)
Commit dbcbabf7da92 ("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 <yuehaibing@huawei.com> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices") Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reported-by: Rafael J. Wysocki <rjw@rjwysocki.net> Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/hid/hid-logitech-dj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)