serial: sc16is7xx: unconditionally clear line bit in sc16is7xx_remove()
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Tue, 9 Apr 2024 15:42:50 +0000 (11:42 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Apr 2024 12:08:08 +0000 (14:08 +0200)
There is no need to check for previous port registration in
sc16is7xx_remove() because if sc16is7xx_probe() succeeded, we are
guaranteed to have successfully registered both ports. We can thus
unconditionally clear the line allocation bit in sc16is7xx_lines.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20240409154253.3043822-3-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sc16is7xx.c

index afcfb4f3894521724dca44f96c1adae96a6482db..a134cd2a931db575cd69a468f12df7ec58cbbce8 100644 (file)
@@ -1660,8 +1660,8 @@ static void sc16is7xx_remove(struct device *dev)
 
        for (i = 0; i < s->devtype->nr_uart; i++) {
                kthread_cancel_delayed_work_sync(&s->p[i].ms_work);
-               if (test_and_clear_bit(s->p[i].port.line, sc16is7xx_lines))
-                       uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port);
+               clear_bit(s->p[i].port.line, sc16is7xx_lines);
+               uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port);
                sc16is7xx_power(&s->p[i].port, 0);
        }