blob: 64c0bc28615d876e03a82b5d3a4113ad5a614a34 [file] [log] [blame]
From e9e4eea2dd6ae0e7e379ff184c3ff40698f7b2c9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <>
Date: Mon, 29 Jul 2019 17:50:36 +0200
Subject: [PATCH] HID: logitech-dj: Really fix return value of
commit 6fb08f1a5f7e5cdde1ce00104788e602f4299b99 upstream.
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 <>
Cc: Rafael J. Wysocki <>
Cc: Lionel Landwerlin <>
Fixes: dbcbabf7da92 ("HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices")
Reported-by: Lionel Landwerlin <>
Reported-by: Rafael J. Wysocki <>
Signed-off-by: Hans de Goede <>
Tested-by: Rafael J. Wysocki <>
Reviewed-by: Petr Vorel <>
Tested-by: Petr Vorel <>
Reviewed-by: YueHaibing <>
Signed-off-by: Jiri Kosina <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 651a74df6978..09ee227b1a35 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -1123,7 +1123,7 @@ static int logi_dj_recv_query_hidpp_devices(struct dj_receiver_dev *djrcv_dev)
- return retval;
+ return (retval < 0) ? retval : 0;
static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)