Skip to contentSkip to conversation

usb: udc: pxa: remove unused platform_data

bug report Dan Carpenter 2 participants 2 messages May 21 – May 26 USB

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 8 lines · Dan Carpenter

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/[email protected]/

Arnd