* [PATCH] usb: gadget: u_serial: remove some dead code
@ 2025-06-25 15:21 Dan Carpenter
2025-06-26 6:23 ` Prashanth K
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2025-06-25 15:21 UTC (permalink / raw)
To: Prashanth K, Greg Kroah-Hartman
Cc: Lianqin Hu, Krzysztof Kozlowski, Jeff Johnson, Michael Walle,
linux-usb, linux-kernel, kernel-janitors
There is no need to check if "port" is NULL. We already verified that it
is non-NULL. It's a stack variable and can't be modified by a different
thread. Delete this dead code.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/usb/gadget/function/u_serial.c | 7 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index ab544f6824be..96756a489d6a 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1501,13 +1501,7 @@ void gserial_suspend(struct gserial *gser)
spin_unlock_irqrestore(&serial_port_lock, flags);
if (!gserial_wakeup_host(gser))
return;
-
- /* Check if port is valid after acquiring lock back */
spin_lock_irqsave(&serial_port_lock, flags);
- if (!port) {
- spin_unlock_irqrestore(&serial_port_lock, flags);
- return;
- }
}
spin_lock(&port->port_lock);
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: u_serial: remove some dead code
2025-06-25 15:21 [PATCH] usb: gadget: u_serial: remove some dead code Dan Carpenter
@ 2025-06-26 6:23 ` Prashanth K
2025-06-26 13:21 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Prashanth K @ 2025-06-26 6:23 UTC (permalink / raw)
To: Dan Carpenter, Greg Kroah-Hartman
Cc: Lianqin Hu, Krzysztof Kozlowski, Jeff Johnson, Michael Walle,
linux-usb, linux-kernel, kernel-janitors
On 6/25/2025 8:51 PM, Dan Carpenter wrote:
> There is no need to check if "port" is NULL. We already verified that it
> is non-NULL. It's a stack variable and can't be modified by a different
> thread. Delete this dead code.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
Perhaps you could add Closes and Fixes tag, but its up to you.
Reviewed-by: Prashanth K <prashanth.k@oss.qualcomm.com>
> drivers/usb/gadget/function/u_serial.c | 7 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
> index ab544f6824be..96756a489d6a 100644
> --- a/drivers/usb/gadget/function/u_serial.c
> +++ b/drivers/usb/gadget/function/u_serial.c
> @@ -1501,13 +1501,7 @@ void gserial_suspend(struct gserial *gser)
> spin_unlock_irqrestore(&serial_port_lock, flags);
> if (!gserial_wakeup_host(gser))
> return;
> -
> - /* Check if port is valid after acquiring lock back */
> spin_lock_irqsave(&serial_port_lock, flags);
> - if (!port) {
> - spin_unlock_irqrestore(&serial_port_lock, flags);
> - return;
> - }
> }
>
> spin_lock(&port->port_lock);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: u_serial: remove some dead code
2025-06-26 6:23 ` Prashanth K
@ 2025-06-26 13:21 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-06-26 13:21 UTC (permalink / raw)
To: Prashanth K
Cc: Greg Kroah-Hartman, Lianqin Hu, Krzysztof Kozlowski, Jeff Johnson,
Michael Walle, linux-usb, linux-kernel, kernel-janitors
On Thu, Jun 26, 2025 at 11:53:05AM +0530, Prashanth K wrote:
>
>
> On 6/25/2025 8:51 PM, Dan Carpenter wrote:
> > There is no need to check if "port" is NULL. We already verified that it
> > is non-NULL. It's a stack variable and can't be modified by a different
> > thread. Delete this dead code.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
>
> Perhaps you could add Closes and Fixes tag, but its up to you.
Fixes is only for bugs. If I put a Closes tag, then I'd have to give
myself reported by credit as well which is just being greedy for tags. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-26 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 15:21 [PATCH] usb: gadget: u_serial: remove some dead code Dan Carpenter
2025-06-26 6:23 ` Prashanth K
2025-06-26 13:21 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox