serial: core: Simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzk@kernel.org>
Tue, 1 Sep 2020 15:31:00 +0000 (17:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Sep 2020 15:14:31 +0000 (17:14 +0200)
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/r/20200901153100.18827-2-krzk@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c

index 4d31338..6ea13d3 100644 (file)
@@ -3264,9 +3264,7 @@ int uart_get_rs485_mode(struct uart_port *port)
        if (IS_ERR(port->rs485_term_gpio)) {
                ret = PTR_ERR(port->rs485_term_gpio);
                port->rs485_term_gpio = NULL;
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "Cannot get rs485-term-gpios\n");
-               return ret;
+               return dev_err_probe(dev, ret, "Cannot get rs485-term-gpios\n");
        }
 
        return 0;