Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: vcc: Drop impossible to hit WARN_ON

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>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
63e34e70 6da629c8

+2 -5
+2 -5
drivers/tty/vcc.c
··· 692 692 tty_vhangup(port->tty); 693 693 694 694 /* Get exclusive reference to VCC, ensures that there are no other 695 - * clients to this port 695 + * clients to this port. This cannot fail. 696 696 */ 697 - port = vcc_get(port->index, true); 698 - 699 - if (WARN_ON(!port)) 700 - return -ENODEV; 697 + vcc_get(port->index, true); 701 698 702 699 tty_unregister_device(vcc_tty_driver, port->index); 703 700