Skip to contentSkip to conversation

usb: cdns2: Add main part of Cadence USBHS driver

bug report Dan Carpenter 1 participant 1 message Dec 11, 2025 USB

lore
Share & tools
lore
#0 lore raw

Hello Pawel Laszczak,

Commit 3eb1f1efe204 ("usb: cdns2: Add main part of Cadence USBHS driver") from Jun 2, 2023 (linux-next), leads to the following Smatch static checker warning:

	drivers/usb/gadget/udc/cdns2/cdns2-gadget.c:1239 cdns2_thread_usb_irq_handler()
	warn: 0x10000 is larger than 8 bits

drivers/usb/gadget/udc/cdns2/cdns2-gadget.c

    1210 static irqreturn_t cdns2_thread_usb_irq_handler(struct cdns2_device *pdev)
    1211 {
    1212         u8 usb_irq, ext_irq;
    1213         int speed;
    1214         int i;
    1215 
    1216         ext_irq = readb(&pdev->interrupt_regs->extirq) & EXTIRQ_WAKEUP;
    1217         writeb(ext_irq, &pdev->interrupt_regs->extirq);
    1218 
    1219         usb_irq = readb(&pdev->interrupt_regs->usbirq) & USB_IEN_INIT;
    1220         writeb(usb_irq, &pdev->interrupt_regs->usbirq);
    1221 
    1222         if (!ext_irq && !usb_irq)
    1223                 return IRQ_NONE;
    1224 
    1225         trace_cdns2_usb_irq(usb_irq, ext_irq);
    1226 
    1227         if (ext_irq & EXTIRQ_WAKEUP) {
    1228                 if (pdev->gadget_driver && pdev->gadget_driver->resume) {
    1229                         spin_unlock(&pdev->lock);
    1230                         pdev->gadget_driver->resume(&pdev->gadget);
    1231                         spin_lock(&pdev->lock);
    1232                 }
    1233         }
    1234 
    1235         if (usb_irq & USBIRQ_LPM) {
    1236                 u8 reg = readb(&pdev->usb_regs->lpmctrl);
    1237 
    1238                 /* LPM1 enter */

--> 1239 if (!(reg & LPMCTRLLH_LPMNYET))

LPMCTRLLH_LPMNYET is BIT(16) but "reg" is a u8, so this condition is always true.

    1240                         writeb(0, &pdev->usb_regs->sleep_clkgate);
    1241         }
    1242 
    1243         if (usb_irq & USBIRQ_SUSPEND) {

regards,
dan carpenter