usb: gadget: atmel: Add missing null check

Add in the missing null check for udc->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>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Link: https://lore.kernel.org/r/20250929-atmel_usba_udc-v1-1-e1426271e12a@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
This commit is contained in:
Andrew Goodbody 2025-09-29 17:25:23 +01:00 committed by Mattijs Korpershoek
parent 3ce8a0e911
commit f586675872

View File

@ -1147,7 +1147,7 @@ static int usba_udc_irq(struct usba_udc *udc)
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);