All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: atmel: Add missing null check
@ 2025-09-29 16:25 Andrew Goodbody
  2025-09-29 23:05 ` Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Goodbody @ 2025-09-29 16:25 UTC (permalink / raw)
  To: Lukasz Majewski, Mattijs Korpershoek, Marek Vasut, Tom Rini
  Cc: Zixun LI, u-boot, Andrew Goodbody

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>
---
 drivers/usb/gadget/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 72f68dba3a741b7f0aac8ba89b83eefb5e0cce4f..f7a92ded6dab187475249874db37d81a07bf5b9e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -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);

---
base-commit: 9710d98e8942151fc0c62d54100d9d27e8263d04
change-id: 20250929-atmel_usba_udc-046059597928

Best regards,
-- 
Andrew Goodbody <andrew.goodbody@linaro.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: gadget: atmel: Add missing null check
  2025-09-29 16:25 [PATCH] usb: gadget: atmel: Add missing null check Andrew Goodbody
@ 2025-09-29 23:05 ` Marek Vasut
  2025-09-30  7:50 ` Mattijs Korpershoek
  2025-09-30  9:51 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2025-09-29 23:05 UTC (permalink / raw)
  To: Andrew Goodbody, Lukasz Majewski, Mattijs Korpershoek, Tom Rini
  Cc: Zixun LI, u-boot

On 9/29/25 6:25 PM, Andrew Goodbody wrote:
> 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: Marek Vasut <marek.vasut@mailbox.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: gadget: atmel: Add missing null check
  2025-09-29 16:25 [PATCH] usb: gadget: atmel: Add missing null check Andrew Goodbody
  2025-09-29 23:05 ` Marek Vasut
@ 2025-09-30  7:50 ` Mattijs Korpershoek
  2025-09-30  9:51 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2025-09-30  7:50 UTC (permalink / raw)
  To: Andrew Goodbody, Lukasz Majewski, Mattijs Korpershoek,
	Marek Vasut, Tom Rini
  Cc: Zixun LI, u-boot, Andrew Goodbody

Hi Andrew,

Thank you for the patch.

On Mon, Sep 29, 2025 at 17:25, Andrew Goodbody <andrew.goodbody@linaro.org> wrote:

> 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>

> ---
>  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 72f68dba3a741b7f0aac8ba89b83eefb5e0cce4f..f7a92ded6dab187475249874db37d81a07bf5b9e 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -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);
>
> ---
> base-commit: 9710d98e8942151fc0c62d54100d9d27e8263d04
> change-id: 20250929-atmel_usba_udc-046059597928
>
> Best regards,
> -- 
> Andrew Goodbody <andrew.goodbody@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: gadget: atmel: Add missing null check
  2025-09-29 16:25 [PATCH] usb: gadget: atmel: Add missing null check Andrew Goodbody
  2025-09-29 23:05 ` Marek Vasut
  2025-09-30  7:50 ` Mattijs Korpershoek
@ 2025-09-30  9:51 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2025-09-30  9:51 UTC (permalink / raw)
  To: Lukasz Majewski, Marek Vasut, Tom Rini, Andrew Goodbody; +Cc: Zixun LI, u-boot

Hi,

On Mon, 29 Sep 2025 17:25:23 +0100, Andrew Goodbody wrote:
> 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.
> 
> 

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu-next)

[1/1] usb: gadget: atmel: Add missing null check
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/f58667587243ce652aaa7d0dd6557a2fb2da5020

--
Mattijs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-30  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29 16:25 [PATCH] usb: gadget: atmel: Add missing null check Andrew Goodbody
2025-09-29 23:05 ` Marek Vasut
2025-09-30  7:50 ` Mattijs Korpershoek
2025-09-30  9:51 ` Mattijs Korpershoek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.