Linux USB
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Prashanth K <prashanth.k@oss.qualcomm.com>
Cc: linux-usb@vger.kernel.org
Subject: [bug report] usb: gadget: u_serial: Implement remote wakeup capability
Date: Wed, 30 Apr 2025 11:09:26 +0300	[thread overview]
Message-ID: <aBHatifO5bjR1yPt@stanley.mountain> (raw)

Hello Prashanth K,

Commit 3baea29dc0a7 ("usb: gadget: u_serial: Implement remote wakeup
capability") from Apr 24, 2025 (linux-next), leads to the following
Smatch static checker warning:

drivers/usb/gadget/function/u_serial.c:1511 gserial_suspend() warn: double unlock 'global &serial_port_lock' (orig line 1505)
drivers/usb/gadget/function/u_serial.c:1514 gserial_suspend() warn: double unlock 'flags' (orig line 1505)

drivers/usb/gadget/function/u_serial.c
    1501         }
    1502 
    1503         if (port->write_busy || port->write_started) {
    1504                 /* Wakeup to host if there are ongoing transfers */
    1505                 spin_unlock_irqrestore(&serial_port_lock, flags);
                                                 ^^^^^^^^^^^^^^^^  ^^^^^
We unlock here.

    1506                 if (!gserial_wakeup_host(gser))

Assume gserial_wakeup_host() fails so we don't return on the next line.

    1507                         return;
    1508         }
    1509 
    1510         spin_lock(&port->port_lock);
--> 1511         spin_unlock(&serial_port_lock);
                             ^^^^^^^^^^^^^^^^^
Double unlock.

    1512         port->suspended = true;
    1513         port->start_delayed = true;
    1514         spin_unlock_irqrestore(&port->port_lock, flags);
                                                          ^^^^^
IRQs were already enabled.  Which is probably fine, I don't know.

    1515 }

regards,
dan carpenter

             reply	other threads:[~2025-04-30  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30  8:09 Dan Carpenter [this message]
2025-04-30 10:36 ` [bug report] usb: gadget: u_serial: Implement remote wakeup capability Prashanth K
2025-04-30 10:43   ` Dan Carpenter

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=aBHatifO5bjR1yPt@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=prashanth.k@oss.qualcomm.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