Skip to contentSkip to conversation

usb: ohci: Balance controller wakeup on cleanup

PATCH In review Myeonghun Pak 3 participants 8 messages Sep 15

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover usb: ohci: Balance controller wakeup on cleanup

These four independent fixes disable controller wakeup after HCD removal in the DA8xx, S3C2410, SPEAr and ST drivers. DA8xx also needs the same cleanup when notifier registration fails after the HCD is added.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Assisted-by LLM

Myeonghun Pak (4):
usb: ohci-da8xx: disable controller wakeup on cleanup
usb: ohci-s3c2410: disable controller wakeup on removal
usb: ohci-spear: disable controller wakeup on removal
usb: ohci-st: disable controller wakeup on removal

#1 lore raw

PATCH 1/4 usb: ohci-da8xx: disable controller wakeup on cleanup

The OHCI core marks controllers with RemoteWakeupConnected as wakeup-capable. Probe enables wakeup, but neither removal nor a later notifier registration failure disables it, leaving the wakeup source attached.

Disable controller wakeup after removing the HCD on both paths.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes a6eeeb9f45b5 ("USB: Update USB default wakeup settings")
Assisted-by LLM
---
 drivers/usb/host/ohci-da8xx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ohci-da8xx.c +2 -0
@@ -447,6 +447,7 @@
 
 err_remove_hcd:
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 err:
 	usb_put_hcd(hcd);
 	return error;
@@ -457,5 +458,6 @@
 	struct usb_hcd	*hcd = platform_get_drvdata(pdev);
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 	usb_put_hcd(hcd);
 }
#2 lore raw

PATCH 2/4 usb: ohci-s3c2410: disable controller wakeup on removal

In reply to Myeonghun Pak

Probe enables controller wakeup after the OHCI core marks controllers with RemoteWakeupConnected as wakeup-capable. Removal does not undo this, so the wakeup source can remain attached after driver unbind.

Disable controller wakeup after removing the HCD.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes a6eeeb9f45b5 ("USB: Update USB default wakeup settings")
Assisted-by LLM
---
 drivers/usb/host/ohci-s3c2410.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-s3c2410.c +1 -0
@@ -335,6 +335,7 @@
 	struct usb_hcd *hcd = platform_get_drvdata(dev);
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 	s3c2410_stop_hc(dev);
 	usb_put_hcd(hcd);
 }
#3 lore raw

PATCH 3/4 usb: ohci-spear: disable controller wakeup on removal

In reply to Myeonghun Pak

Probe enables controller wakeup after the OHCI core marks controllers with RemoteWakeupConnected as wakeup-capable. Removal does not undo this, so the wakeup source can remain attached after driver unbind.

Disable controller wakeup after removing the HCD.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes a6eeeb9f45b5 ("USB: Update USB default wakeup settings")
Assisted-by LLM
---
 drivers/usb/host/ohci-spear.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-spear.c +1 -0
@@ -103,6 +103,7 @@
 	struct spear_ohci *sohci_p = to_spear_ohci(hcd);
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 	clk_disable_unprepare(sohci_p->clk);
 
 	usb_put_hcd(hcd);
#4 lore raw

PATCH 4/4 usb: ohci-st: disable controller wakeup on removal

In reply to Myeonghun Pak

Probe enables controller wakeup after the OHCI core marks controllers with RemoteWakeupConnected as wakeup-capable. Removal does not undo this, so the wakeup source can remain attached after driver unbind.

Disable controller wakeup after removing the HCD.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
Assisted-by LLM
---
 drivers/usb/host/ohci-st.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-st.c +1 -0
@@ -235,6 +235,7 @@
 	int clk;
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 
 	if (pdata->power_off)
 		pdata->power_off(dev);
maintainer
#5 lore raw

Re: [PATCH 4/4] usb: ohci-st: disable controller wakeup on removal

Quoted 30 lines · Myeonghun Pak

Probe enables controller wakeup after the OHCI core marks controllers with RemoteWakeupConnected as wakeup-capable. Removal does not undo this, so the wakeup source can remain attached after driver unbind.

Disable controller wakeup after removing the HCD.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
Assisted-by LLM
---
 drivers/usb/host/ohci-st.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-st.c +1 -0
@@ -235,6 +235,7 @@
 	int clk;
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 
 	if (pdata->power_off)
 		pdata->power_off(dev);
maintainer Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH 4/4] usb: ohci-st: disable controller wakeup on removal

In reply to Myeonghun Pak
Quoted 23 lines · Myeonghun Pak

Probe enables controller wakeup after the OHCI core marks controllers with RemoteWakeupConnected as wakeup-capable. Removal does not undo this, so the wakeup source can remain attached after driver unbind.

Disable controller wakeup after removing the HCD.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes d115837259ad ("usb: host: ohci-st: Add OHCI driver support for ST STB devices")
Assisted-by LLM
---
 drivers/usb/host/ohci-st.c | 1 +
 1 file changed, 1 insertion(+)

drivers/usb/host/ohci-st.c line 241

Quoted 7 lines
drivers/usb/host/ohci-st.c +1 -0
@@ -235,6 +235,7 @@
 	int clk;
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 
 	if (pdata->power_off)
 		pdata->power_off(dev);

Hi Myeonghun

Thanks
Patrice

maintainer Acked-by on the v1 series
#7 lore raw
In reply to Myeonghun Pak
Quoted 7 lines · Myeonghun Pak

These four independent fixes disable controller wakeup after HCD removal in the DA8xx, S3C2410, SPEAr and ST drivers. DA8xx also needs the same cleanup when notifier registration fails after the HCD is added.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Quoted 7 lines
Assisted-by LLM

Myeonghun Pak (4):
usb: ohci-da8xx: disable controller wakeup on cleanup
usb: ohci-s3c2410: disable controller wakeup on removal
usb: ohci-spear: disable controller wakeup on removal
usb: ohci-st: disable controller wakeup on removal

For all four patches: