* [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add()
@ 2023-06-02 7:00 Tony Lindgren
2023-06-02 7:22 ` Jiri Slaby
2023-06-02 14:53 ` Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Tony Lindgren @ 2023-06-02 7:00 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko
Cc: Andy Shevchenko, Dhruva Gole, Ilpo Järvinen, John Ogness,
Johan Hovold, Sebastian Andrzej Siewior, Vignesh Raghavendra,
linux-omap, linux-serial, linux-kernel
Checking for NULL is incorrect as serial_base_ctrl_add() uses ERR_PTR().
Let's also pass any returned error along, there's no reason to translate
all errors to -ENODEV.
Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
Changes since v1:
- Stop translating all errors to -ENODEV
- There's no need to use IS_ERR_OR_NULL() as noted by Jiri
---
drivers/tty/serial/serial_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3342,8 +3342,8 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port)
ctrl_dev = serial_core_ctrl_find(drv, port->dev, port->ctrl_id);
if (!ctrl_dev) {
new_ctrl_dev = serial_core_ctrl_device_add(port);
- if (!new_ctrl_dev) {
- ret = -ENODEV;
+ if (IS_ERR(new_ctrl_dev)) {
+ ret = PTR_ERR(new_ctrl_dev);
goto err_unlock;
}
ctrl_dev = new_ctrl_dev;
--
2.41.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add()
2023-06-02 7:00 [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add() Tony Lindgren
@ 2023-06-02 7:22 ` Jiri Slaby
2023-06-02 14:53 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2023-06-02 7:22 UTC (permalink / raw)
To: Tony Lindgren, Greg Kroah-Hartman, Andy Shevchenko
Cc: Andy Shevchenko, Dhruva Gole, Ilpo Järvinen, John Ogness,
Johan Hovold, Sebastian Andrzej Siewior, Vignesh Raghavendra,
linux-omap, linux-serial, linux-kernel
On 02. 06. 23, 9:00, Tony Lindgren wrote:
> Checking for NULL is incorrect as serial_base_ctrl_add() uses ERR_PTR().
>
> Let's also pass any returned error along, there's no reason to translate
> all errors to -ENODEV.
>
> Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add()
2023-06-02 7:00 [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add() Tony Lindgren
2023-06-02 7:22 ` Jiri Slaby
@ 2023-06-02 14:53 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-06-02 14:53 UTC (permalink / raw)
To: Tony Lindgren
Cc: Greg Kroah-Hartman, Jiri Slaby, Dhruva Gole, Ilpo Järvinen,
John Ogness, Johan Hovold, Sebastian Andrzej Siewior,
Vignesh Raghavendra, linux-omap, linux-serial, linux-kernel
On Fri, Jun 02, 2023 at 10:00:05AM +0300, Tony Lindgren wrote:
> Checking for NULL is incorrect as serial_base_ctrl_add() uses ERR_PTR().
>
> Let's also pass any returned error along, there's no reason to translate
> all errors to -ENODEV.
Jiri already asked the same question I have had on a glance, and this all
solved here, so
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>
> Changes since v1:
>
> - Stop translating all errors to -ENODEV
>
> - There's no need to use IS_ERR_OR_NULL() as noted by Jiri
>
> ---
> drivers/tty/serial/serial_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -3342,8 +3342,8 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port)
> ctrl_dev = serial_core_ctrl_find(drv, port->dev, port->ctrl_id);
> if (!ctrl_dev) {
> new_ctrl_dev = serial_core_ctrl_device_add(port);
> - if (!new_ctrl_dev) {
> - ret = -ENODEV;
> + if (IS_ERR(new_ctrl_dev)) {
> + ret = PTR_ERR(new_ctrl_dev);
> goto err_unlock;
> }
> ctrl_dev = new_ctrl_dev;
> --
> 2.41.0
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-02 14:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 7:00 [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add() Tony Lindgren
2023-06-02 7:22 ` Jiri Slaby
2023-06-02 14:53 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox