diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2014-05-06 11:16:07 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-05-14 10:23:26 -0400 |
commit | bcdbc084ebab447f6eb1add7b953f125b0c8174b (patch) | |
tree | db0bf0f104402ab0d436312cd124fccb1bfa4dd9 /drivers/usb/gadget/atmel_usba_udc.c | |
parent | 4d9f872ced245ef0c712f0f04adf446d37813c57 (diff) |
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 <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
1686 | reset_all_endpoints(udc); | 1686 | reset_all_endpoints(udc); |
1687 | 1687 | ||
1688 | if (udc->gadget.speed != USB_SPEED_UNKNOWN | 1688 | if (udc->gadget.speed != USB_SPEED_UNKNOWN |
1689 | && udc->driver->disconnect) { | 1689 | && udc->driver && udc->driver->disconnect) { |
1690 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1690 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1691 | spin_unlock(&udc->lock); | 1691 | spin_unlock(&udc->lock); |
1692 | udc->driver->disconnect(&udc->gadget); | 1692 | udc->driver->disconnect(&udc->gadget); |