From: Greg Kroah-Hartman Date: Wed, 7 Jun 2023 09:46:29 +0000 (+0200) Subject: 6.3-stable patches X-Git-Tag: v4.14.317~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af7cc83024d2812ea18978951f1a4880e467ba8d;p=thirdparty%2Fkernel%2Fstable-queue.git 6.3-stable patches added patches: hid-hidpp-terminate-retry-loop-on-success.patch --- diff --git a/queue-6.3/hid-hidpp-terminate-retry-loop-on-success.patch b/queue-6.3/hid-hidpp-terminate-retry-loop-on-success.patch new file mode 100644 index 00000000000..70677c654f0 --- /dev/null +++ b/queue-6.3/hid-hidpp-terminate-retry-loop-on-success.patch @@ -0,0 +1,84 @@ +From 7c28afd5512e371773dbb2bf95a31ed5625651d9 Mon Sep 17 00:00:00 2001 +From: Benjamin Tissoires +Date: Mon, 5 Jun 2023 18:56:36 +0200 +Subject: HID: hidpp: terminate retry loop on success + +From: Benjamin Tissoires + +commit 7c28afd5512e371773dbb2bf95a31ed5625651d9 upstream. + +It seems we forgot the normal case to terminate the retry loop, +making us asking 3 times each command, which is probably a little bit +too much. + +And remove the ugly "goto exit" that can be replaced by a simpler "break" + +Fixes: 586e8fede795 ("HID: logitech-hidpp: Retry commands when device is busy") +Suggested-by: Mark Lord +Tested-by: Mark Lord +Signed-off-by: Benjamin Tissoires +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-logitech-hidpp.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/drivers/hid/hid-logitech-hidpp.c ++++ b/drivers/hid/hid-logitech-hidpp.c +@@ -283,7 +283,7 @@ static int hidpp_send_message_sync(struc + struct hidpp_report *message, + struct hidpp_report *response) + { +- int ret; ++ int ret = -1; + int max_retries = 3; + + mutex_lock(&hidpp->send_mutex); +@@ -297,13 +297,13 @@ static int hidpp_send_message_sync(struc + */ + *response = *message; + +- for (; max_retries != 0; max_retries--) { ++ for (; max_retries != 0 && ret; max_retries--) { + ret = __hidpp_send_report(hidpp->hid_dev, message); + + if (ret) { + dbg_hid("__hidpp_send_report returned err: %d\n", ret); + memset(response, 0, sizeof(struct hidpp_report)); +- goto exit; ++ break; + } + + if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, +@@ -311,14 +311,14 @@ static int hidpp_send_message_sync(struc + dbg_hid("%s:timeout waiting for response\n", __func__); + memset(response, 0, sizeof(struct hidpp_report)); + ret = -ETIMEDOUT; +- goto exit; ++ break; + } + + if (response->report_id == REPORT_ID_HIDPP_SHORT && + response->rap.sub_id == HIDPP_ERROR) { + ret = response->rap.params[1]; + dbg_hid("%s:got hidpp error %02X\n", __func__, ret); +- goto exit; ++ break; + } + + if ((response->report_id == REPORT_ID_HIDPP_LONG || +@@ -327,13 +327,12 @@ static int hidpp_send_message_sync(struc + ret = response->fap.params[1]; + if (ret != HIDPP20_ERROR_BUSY) { + dbg_hid("%s:got hidpp 2.0 error %02X\n", __func__, ret); +- goto exit; ++ break; + } + dbg_hid("%s:got busy hidpp 2.0 error %02X, retrying\n", __func__, ret); + } + } + +-exit: + mutex_unlock(&hidpp->send_mutex); + return ret; + diff --git a/queue-6.3/series b/queue-6.3/series index 57e9eb3f331..601bce641d6 100644 --- a/queue-6.3/series +++ b/queue-6.3/series @@ -236,3 +236,4 @@ module-decompress-fix-error-checking-on-zstd-decompression.patch firmware-qcom_scm-use-fixed-width-src-vm-bitmap.patch misc-fastrpc-pass-proper-scm-arguments-for-secure-ma.patch btrfs-call-btrfs_orig_bbio_end_io-in-btrfs_end_bio_w.patch +hid-hidpp-terminate-retry-loop-on-success.patch