serial: 8250_of: fix return code when probe function fails to get reset
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 27 Dec 2017 05:21:05 +0000 (14:21 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 15:46:26 +0000 (16:46 +0100)
The error pointer from devm_reset_control_get_optional_shared() is
not propagated.

One of the most common problem scenarios is it returns -EPROBE_DEFER
when the reset controller has not probed yet.  In this case, the
probe of the reset consumer should be deferred.

Fixes: e2860e1f62f2 ("serial: 8250_of: Add reset support")
Cc: stable@vger.kernel.org # v4.13+
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_of.c

index 1e67a7e4a5fd32e031ad29db382aa12a9a9929bf..160b8906d9b9cbb47e7f5459b23c604778e5eff5 100644 (file)
@@ -136,8 +136,11 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
        }
 
        info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL);
-       if (IS_ERR(info->rst))
+       if (IS_ERR(info->rst)) {
+               ret = PTR_ERR(info->rst);
                goto err_dispose;
+       }
+
        ret = reset_control_deassert(info->rst);
        if (ret)
                goto err_dispose;