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

serial: sccnxp: Improve error message if regulator_disable() fails

Returning an error code from .remove() makes the driver core emit the
little helpful error message:

remove callback returned a non-zero value. This will be ignored.

and then remove the device anyhow.

So replace the error return (and with it the little helpful error
message) by a more useful error message.

Fixes: 31815c08fc90 ("serial: sccnxp: Replace pdata.init/exit with regulator API")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231110152927.70601-3-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
7635d71e ad90d035

+5 -2
+5 -2
drivers/tty/serial/sccnxp.c
··· 1036 1036 1037 1037 uart_unregister_driver(&s->uart); 1038 1038 1039 - if (!IS_ERR(s->regulator)) 1040 - return regulator_disable(s->regulator); 1039 + if (!IS_ERR(s->regulator)) { 1040 + int ret = regulator_disable(s->regulator); 1041 + if (ret) 1042 + dev_err(&pdev->dev, "Failed to disable regulator\n"); 1043 + } 1041 1044 1042 1045 return 0; 1043 1046 }