All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: Add missing null check
@ 2025-09-29 16:40 Andrew Goodbody
  2025-09-29 23:05 ` Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Goodbody @ 2025-09-29 16:40 UTC (permalink / raw)
  To: Lukasz Majewski, Mattijs Korpershoek, Marek Vasut, Tom Rini
  Cc: Junhui Liu, Kongyang Liu, u-boot, Andrew Goodbody

Add in the missing null check for dev->driver that is present at other
points in the function before it is dereferenced.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
index fca052b4556a7d2ae4fe516e39820611d7082e2f..5a7f50ebaa5579f67ea5dc9491d0d1f4d4b81ea1 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
@@ -526,7 +526,7 @@ static int dwc2_udc_irq(int irq, void *_dev)
 		if (gotgint & GOTGINT_SES_END_DET) {
 			debug_cond(DEBUG_ISR, "\t\tSession End Detected\n");
 			/* Let gadget detect disconnected state */
-			if (dev->driver->disconnect) {
+			if (dev->driver && dev->driver->disconnect) {
 				spin_unlock_irqrestore(&dev->lock, flags);
 				dev->driver->disconnect(&dev->gadget);
 				spin_lock_irqsave(&dev->lock, flags);

---
base-commit: 9710d98e8942151fc0c62d54100d9d27e8263d04
change-id: 20250929-usb_dwc2-924d0d26df62

Best regards,
-- 
Andrew Goodbody <andrew.goodbody@linaro.org>


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

end of thread, other threads:[~2025-09-30  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29 16:40 [PATCH] usb: dwc2: Add missing null check Andrew Goodbody
2025-09-29 23:05 ` Marek Vasut
2025-09-30  7:51 ` Mattijs Korpershoek
2025-09-30  9:54 ` Mattijs Korpershoek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.