Linux USB
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Pawel Laszczak <pawell@cadence.com>
Cc: linux-usb@vger.kernel.org
Subject: [bug report] usb: cdns2: Add main part of Cadence USBHS driver
Date: Thu, 11 Dec 2025 10:44:07 +0300	[thread overview]
Message-ID: <aTp2R8dGyrW1XglR@stanley.mountain> (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

                 reply	other threads:[~2025-12-11  7:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTp2R8dGyrW1XglR@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox