Linux USB
 help / color / mirror / Atom feed
* [bug report] usb: udc: pxa: remove unused platform_data
@ 2026-05-21  8:13 Dan Carpenter
  2026-05-26 10:51 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-05-21  8:13 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-usb

Hello Arnd Bergmann,

Commit 25bd55f46032 ("usb: udc: pxa: remove unused platform_data")
from Apr 27, 2026 (linux-next), leads to the following Smatch static
checker warning:

	drivers/usb/gadget/udc/pxa27x_udc.c:2398 pxa_udc_probe()
	warn: 'udc->gpiod' is not an error pointer

drivers/usb/gadget/udc/pxa27x_udc.c
    2372 static int pxa_udc_probe(struct platform_device *pdev)
    2373 {
    2374         struct pxa_udc *udc = &memory;
    2375         int retval = 0;
    2376 
    2377         udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
    2378         if (IS_ERR(udc->gpiod))
    2379                 return PTR_ERR(udc->gpiod);

The error handling moved to here.

    2380 
    2381         udc->regs = devm_platform_ioremap_resource(pdev, 0);
    2382         if (IS_ERR(udc->regs))
    2383                 return PTR_ERR(udc->regs);
    2384         udc->irq = platform_get_irq(pdev, 0);
    2385         if (udc->irq < 0)
    2386                 return udc->irq;
    2387 
    2388         udc->dev = &pdev->dev;
    2389         if (of_have_populated_dt()) {
    2390                 udc->transceiver =
    2391                         devm_usb_get_phy_by_phandle(udc->dev, "phys", 0);
    2392                 if (IS_ERR(udc->transceiver))
    2393                         return PTR_ERR(udc->transceiver);
    2394         } else {
    2395                 udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
    2396         }
    2397 
--> 2398         if (IS_ERR(udc->gpiod)) {
    2399                 dev_err(&pdev->dev, "Couldn't find or request D+ gpio : %ld\n",
    2400                         PTR_ERR(udc->gpiod));
    2401                 return PTR_ERR(udc->gpiod);
    2402         }

This is dead code.

    2403         if (udc->gpiod)
    2404                 gpiod_direction_output(udc->gpiod, 0);

The comments say udc->gpiod can't be NULL either.  Was
devm_gpiod_get_optional() intended?

    2405 
    2406         udc->clk = devm_clk_get(&pdev->dev, NULL);
    2407         if (IS_ERR(udc->clk))
    2408                 return PTR_ERR(udc->clk);
    2409 
    2410         retval = clk_prepare(udc->clk);
    2411         if (retval)
    2412                 return retval;

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

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

* Re: [bug report] usb: udc: pxa: remove unused platform_data
  2026-05-21  8:13 [bug report] usb: udc: pxa: remove unused platform_data Dan Carpenter
@ 2026-05-26 10:51 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2026-05-26 10:51 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-usb

On Thu, May 21, 2026, at 10:13, Dan Carpenter wrote:
> Hello Arnd Bergmann,
>
> Commit 25bd55f46032 ("usb: udc: pxa: remove unused platform_data")
> from Apr 27, 2026 (linux-next), leads to the following Smatch static
> checker warning:
>
> 	drivers/usb/gadget/udc/pxa27x_udc.c:2398 pxa_udc_probe()
> 	warn: 'udc->gpiod' is not an error pointer

Thanks a lot for the report!

I've sent a fix now, please see

https://lore.kernel.org/linux-usb/20260526104810.3906090-1-arnd@kernel.org/

      Arnd

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

end of thread, other threads:[~2026-05-26 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21  8:13 [bug report] usb: udc: pxa: remove unused platform_data Dan Carpenter
2026-05-26 10:51 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox