summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-09-29 17:40:43 +0100
committerMattijs Korpershoek <[email protected]>2025-09-30 11:53:10 +0200
commit5ac61383b2db15b037e87bd353f726eafc49e181 (patch)
tree3a9ae7b11eb6027f64b0085cf77da2ab08133180
parentf58667587243ce652aaa7d0dd6557a2fb2da5020 (diff)
usb: dwc2: Add missing null check
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 <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
index fca052b4556..5a7f50ebaa5 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);