Skip to contentSkip to conversation

FAILED: patch "[PATCH] USB: musb: fix session-bit runtime-PM quirk" failed to apply to 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 23, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 4f190e0b9de89c4c917c3ffb3799e9d00fc534ac Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Mon, 9 Oct 2017 22:46:07 -0500
Subject: [PATCH] USB: musb: fix session-bit runtime-PM quirk

The current session-bit quirk implementation does not prevent the retry counter from underflowing, something which could break runtime PM and keep the device active for a very long time (about 2^32 seconds) after a disconnect.

This notably breaks the B-device timeout case, but could potentially cause problems also when the controller is operating as an A-device.

Fixes 2bff3916fda9 ("usb: musb: Fix PM for hub disconnect")
Cc stable <[email protected]> # 4.9
Cc Tony Lindgren <[email protected]>
drivers/usb/musb/musb_core.c +4 -4
index 029692053dd3..07b8c7152e3d 100644
@@ -1861,22 +1861,22 @@ static void musb_pm_runtime_check_session(struct musb *musb)
 		MUSB_DEVCTL_HR;
 	switch (devctl & ~s) {
 	case MUSB_QUIRK_B_INVALID_VBUS_91:
-		if (musb->quirk_retries--) {
+		if (musb->quirk_retries) {
 			musb_dbg(musb,
 				 "Poll devctl on invalid vbus, assume no session");
 			schedule_delayed_work(&musb->irq_work,
 					      msecs_to_jiffies(1000));
-
+			musb->quirk_retries--;
 			return;
 		}
 		/* fall through */
 	case MUSB_QUIRK_A_DISCONNECT_19:
-		if (musb->quirk_retries--) {
+		if (musb->quirk_retries) {
 			musb_dbg(musb,
 				 "Poll devctl on possible host mode disconnect");
 			schedule_delayed_work(&musb->irq_work,
 					      msecs_to_jiffies(1000));
-
+			musb->quirk_retries--;
 			return;
 		}
 		if (!musb->session)