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: Re: [bug report] usb: gadget: u_serial: Implement remote wakeup capability
Date: Wed, 30 Apr 2025 13:43:29 +0300	[thread overview]
Message-ID: <c1b5e666-290a-4d72-8db0-c4e1d3ea97a2@stanley.mountain> (raw)
In-Reply-To: <f8c4ce3f-7770-42ba-ba1d-af927f769343@oss.qualcomm.com>

On Wed, Apr 30, 2025 at 04:06:00PM +0530, Prashanth K wrote:
> 
> 
> On 30-04-25 01:39 pm, Dan Carpenter wrote:
> > 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
> 
> Can you send a patch, or should i fix it? Let me know.

Could you could send the patch?  Thanks!

regards,
dan carpenter


      reply	other threads:[~2025-04-30 10:43 UTC|newest]

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

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=c1b5e666-290a-4d72-8db0-c4e1d3ea97a2@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