Skip to content

Commit fa56e0e

Browse files
committed
Merge tag 'for-linus-2023060501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fix from Jiri Kosina: - Final, confirmed fix for regression causing some devices connected via Logitech HID++ Unifying receiver take too long to initialize (Benjamin Tissoires) * tag 'for-linus-2023060501' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: hidpp: terminate retry loop on success
2 parents f8dba31 + 7c28afd commit fa56e0e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp,
286286
struct hidpp_report *message,
287287
struct hidpp_report *response)
288288
{
289-
int ret;
289+
int ret = -1;
290290
int max_retries = 3;
291291

292292
mutex_lock(&hidpp->send_mutex);
@@ -300,28 +300,28 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp,
300300
*/
301301
*response = *message;
302302

303-
for (; max_retries != 0; max_retries--) {
303+
for (; max_retries != 0 && ret; max_retries--) {
304304
ret = __hidpp_send_report(hidpp->hid_dev, message);
305305

306306
if (ret) {
307307
dbg_hid("__hidpp_send_report returned err: %d\n", ret);
308308
memset(response, 0, sizeof(struct hidpp_report));
309-
goto exit;
309+
break;
310310
}
311311

312312
if (!wait_event_timeout(hidpp->wait, hidpp->answer_available,
313313
5*HZ)) {
314314
dbg_hid("%s:timeout waiting for response\n", __func__);
315315
memset(response, 0, sizeof(struct hidpp_report));
316316
ret = -ETIMEDOUT;
317-
goto exit;
317+
break;
318318
}
319319

320320
if (response->report_id == REPORT_ID_HIDPP_SHORT &&
321321
response->rap.sub_id == HIDPP_ERROR) {
322322
ret = response->rap.params[1];
323323
dbg_hid("%s:got hidpp error %02X\n", __func__, ret);
324-
goto exit;
324+
break;
325325
}
326326

327327
if ((response->report_id == REPORT_ID_HIDPP_LONG ||
@@ -330,13 +330,12 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp,
330330
ret = response->fap.params[1];
331331
if (ret != HIDPP20_ERROR_BUSY) {
332332
dbg_hid("%s:got hidpp 2.0 error %02X\n", __func__, ret);
333-
goto exit;
333+
break;
334334
}
335335
dbg_hid("%s:got busy hidpp 2.0 error %02X, retrying\n", __func__, ret);
336336
}
337337
}
338338

339-
exit:
340339
mutex_unlock(&hidpp->send_mutex);
341340
return ret;
342341

0 commit comments

Comments
 (0)