Hello,
while working on changing the prototype of struct vio_driver::remove to
return void I noticed a few exit paths in such callbacks that return an
error code.
This is a bad thing because the return value is ignored (which is the
motivation to make it void) and the corresponding device then ends in
some limbo state.
Luckily for the three offenders here these cases cannot happen and are
simplified accordingly. This then makes the patch that changes the
remove callback's prototype simpler because it only changes prototypes
and drops "return 0"s.
Best regards and thanks for considering,
Uwe Kleine-König
Uwe Kleine-König (3):
tty: hvcs: Drop unnecessary if block
tty: vcc: Drop unnecessary if block
tty: vcc: Drop impossible to hit WARN_ON
drivers/tty/hvc/hvcs.c | 3 ---
drivers/tty/vcc.c | 10 ++--------
2 files changed, 2 insertions(+), 11 deletions(-)
--
2.29.2
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.
Signed-off-by: Uwe Kleine-König <redacted>
---
drivers/tty/vcc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
@@ -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-*clientstothisport+*clientstothisport.Thiscannotfail.*/-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);
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.
Signed-off-by: Uwe Kleine-König <redacted>
@@ -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-*clientstothisport+*clientstothisport.Thiscannotfail.*/-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);
If hvcs_probe() succeeded dev_set_drvdata() is called with a non-NULL
value, and if hvcs_probe() failed hvcs_remove() isn't called.
So there is no way dev_get_drvdata() can return NULL in hvcs_remove() and
the check can just go away.
Signed-off-by: Uwe Kleine-König <redacted>
---
drivers/tty/hvc/hvcs.c | 3 ---
1 file changed, 3 deletions(-)
@@ -825,9 +825,6 @@ static int hvcs_remove(struct vio_dev *dev)unsignedlongflags;structtty_struct*tty;-if(!hvcsd)-return-ENODEV;-/* By this time the vty-server won't be getting any more interrupts */spin_lock_irqsave(&hvcsd->lock,flags);
If hvcs_probe() succeeded dev_set_drvdata() is called with a non-NULL
value, and if hvcs_probe() failed hvcs_remove() isn't called.
So there is no way dev_get_drvdata() can return NULL in hvcs_remove() and
the check can just go away.
Signed-off-by: Uwe Kleine-König <redacted>
@@ -825,9 +825,6 @@ static int hvcs_remove(struct vio_dev *dev)unsignedlongflags;structtty_struct*tty;-if(!hvcsd)-return-ENODEV;-/* By this time the vty-server won't be getting any more interrupts */spin_lock_irqsave(&hvcsd->lock,flags);
If hvcs_probe() succeeded dev_set_drvdata() is called with a non-NULL
value, and if hvcs_probe() failed hvcs_remove() isn't called.
So there is no way dev_get_drvdata() can return NULL in hvcs_remove() and
the check can just go away.
Signed-off-by: Uwe Kleine-König <redacted>
@@ -825,9 +825,6 @@ static int hvcs_remove(struct vio_dev *dev)unsignedlongflags;structtty_struct*tty;-if(!hvcsd)-return-ENODEV;-/* By this time the vty-server won't be getting any more interrupts */spin_lock_irqsave(&hvcsd->lock,flags);
If vcc_probe() succeeded dev_set_drvdata() is called with a non-NULL
value, and if vcc_probe() failed vcc_remove() isn't called.
So there is no way dev_get_drvdata() can return NULL in vcc_remove() and
the check can just go away.
Signed-off-by: Uwe Kleine-König <redacted>
---
drivers/tty/vcc.c | 3 ---
1 file changed, 3 deletions(-)
If vcc_probe() succeeded dev_set_drvdata() is called with a non-NULL
value, and if vcc_probe() failed vcc_remove() isn't called.
So there is no way dev_get_drvdata() can return NULL in vcc_remove() and
the check can just go away.
Signed-off-by: Uwe Kleine-König <redacted>