[PATCH] usb: dwc2: Add missing null check

Marek Vasut marek.vasut at mailbox.org
Tue Sep 30 01:05:27 CEST 2025


On 9/29/25 6:40 PM, Andrew Goodbody wrote:
> 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 at 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) {

Reviewed-by: Marek Vasut <marek.vasut at mailbox.org>


More information about the U-Boot mailing list