From: Frieder Schrempf <frieder.schre...@kontron.de>

If CONFIG_GPIOLIB is not enabled, mctrl_gpio_init() will return
-ENOSYS and cause the probing of the imx UART to fail. As the
GPIOs are optional, we should continue probing in this case.

Signed-off-by: Frieder Schrempf <frieder.schre...@kontron.de>
---
 drivers/tty/serial/imx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 10db3e54ac9e..51714498dacf 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2237,7 +2237,9 @@ static int imx_uart_probe(struct platform_device *pdev)
        timer_setup(&sport->timer, imx_uart_timeout, 0);
 
        sport->gpios = mctrl_gpio_init(&sport->port, 0);
-       if (IS_ERR(sport->gpios))
+       if (PTR_ERR(sport->gpios) == -ENOSYS)
+               sport->gpios = NULL;
+       else if (IS_ERR(sport->gpios))
                return PTR_ERR(sport->gpios);
 
        sport->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
-- 
2.17.1

Reply via email to