linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] usb: cdns2: Add main part of Cadence USBHS driver
@ 2025-12-11  7:44 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-12-11  7:44 UTC (permalink / raw)
  To: Pawel Laszczak; +Cc: linux-usb

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-11  7:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11  7:44 [bug report] usb: cdns2: Add main part of Cadence USBHS driver Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).