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@xxxxxxxxxx> --- 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