tty: vcc: Drop impossible to hit WARN_ON
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 14 Jan 2021 17:57:18 +0000 (18:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Jan 2021 09:21:42 +0000 (10:21 +0100)
vcc_get() returns the port that has provided port->index. As the port that
is about to be removed isn't removed yet this trivially will find this
port. So simplify the call to not assign an identical value to the port
pointer and drop the warning that is never hit.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210114175718.137483-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vcc.c

index d9b0dc6deae9102f0102b41f7907b5dc3b3a880b..e2d6205f83ce1794aeb7fea4c0f4b844ea7ae20a 100644 (file)
@@ -692,12 +692,9 @@ static int vcc_remove(struct vio_dev *vdev)
                tty_vhangup(port->tty);
 
        /* Get exclusive reference to VCC, ensures that there are no other
-        * clients to this port
+        * clients to this port. This cannot fail.
         */
-       port = vcc_get(port->index, true);
-
-       if (WARN_ON(!port))
-               return -ENODEV;
+       vcc_get(port->index, true);
 
        tty_unregister_device(vcc_tty_driver, port->index);