When an input device is closed, we set a feature report to reset lizard
mode and IMU mode. However, if the input device is closed because it was
removed, then we will necessarily error out when sending this, resulting in
logged errors. Since an error here is expected, we should just fail
silently.
Signed-off-by: Vicki Pfau <redacted>
---
drivers/hid/hid-steam.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index 461ebf37171b..7226c0681ed1 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -490,9 +490,13 @@ static int steam_recv_report_id(struct steam_device *steam,
}
kfree(buf);
- if (ret < 0)
+ /*
+ * Don't log if the failure is -ENODEV, as this
+ * can happen normally on disconnect.
+ */
+ if (ret < 0 && ret != -ENODEV)
hid_err(steam->hdev, "%s: error %d\n", __func__, ret);
- else
+ else if (ret > 0)
hid_dbg(steam->hdev, "Received report %*ph\n", size, data);
if (ret < 0)
return ret;
@@ -557,7 +561,11 @@ static int steam_send_report_id(struct steam_device *steam,
} while (--retries);
kfree(buf);
- if (ret < 0)
+ /*
+ * Don't log if the failure is -ENODEV, as this
+ * can happen normally on disconnect.
+ */
+ if (ret < 0 && ret != -ENODEV)
hid_err(steam->hdev, "%s: error %d (%*ph)\n", __func__,
ret, size, cmd);
return ret;
--
2.54.0