Linux USB
 help / color / mirror / Atom feed
* [bug report] usb: gadget: u_serial: Implement remote wakeup capability
@ 2025-04-30  8:09 Dan Carpenter
  2025-04-30 10:36 ` Prashanth K
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2025-04-30  8:09 UTC (permalink / raw)
  To: Prashanth K; +Cc: linux-usb

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-30 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox