public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: gadget: remove warning during kernel boot
@ 2024-02-20  8:12 Ray Chi
  2024-02-20  8:20 ` Ray Chi
  2024-02-20  8:34 ` Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Ray Chi @ 2024-02-20  8:12 UTC (permalink / raw)
  To: Thinh.Nguyen, gregkh, quic_uaggarwa
  Cc: albertccwang, linux-usb, linux-kernel, Ray Chi, stable

The dwc3->gadget_driver is not initialized during the dwc3 probe
process. This leads to a warning when the runtime power management (PM)
attempts to suspend the gadget using dwc3_gadget_suspend().

This patch adds a check to prevent the warning.

Cc: stable@vger.kernel.org
Fixes: 61a348857e86 ("usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend")
Signed-off-by: Ray Chi <raychi@google.com>
---
 drivers/usb/dwc3/gadget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 28f49400f3e8..de987cffe1ec 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -4708,6 +4708,9 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)
 	unsigned long flags;
 	int ret;
 
+	if (!dwc->gadget_driver)
+		return 0;
+
 	ret = dwc3_gadget_soft_disconnect(dwc);
 	if (ret)
 		goto err;
-- 
2.44.0.rc0.258.g7320e95886-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-23 10:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20  8:12 [PATCH] usb: dwc3: gadget: remove warning during kernel boot Ray Chi
2024-02-20  8:20 ` Ray Chi
2024-02-20  8:39   ` Greg KH
2024-02-20  8:34 ` Greg KH
2024-02-20  8:40   ` Krishna Kurapati PSSNV
2024-02-20  9:42     ` Ray Chi
2024-02-20 13:56       ` Greg KH
2024-02-23 10:36         ` Ray Chi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox