From: Alexandre Belloni Date: Tue, 6 May 2014 15:16:07 +0000 (+0200) Subject: usb: gadget: atmel_usba: always test udc->driver X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bcdbc084ebab447f6eb1add7b953f125b0c8174b;p=openwrt%2Fstaging%2Fblogic.git usb: gadget: atmel_usba: always test udc->driver Found using smatch: drivers/usb/gadget/atmel_usba_udc.c:1689 usba_udc_irq() error: we previously assumed 'udc->driver' could be null (see line 1636) Always test udc->driver before using its members. Acked-by: Nicolas Ferre Signed-off-by: Alexandre Belloni Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 9f65324f9ae0..76023ce449a3 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -1686,7 +1686,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) reset_all_endpoints(udc); if (udc->gadget.speed != USB_SPEED_UNKNOWN - && udc->driver->disconnect) { + && udc->driver && udc->driver->disconnect) { udc->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock(&udc->lock); udc->driver->disconnect(&udc->gadget);