Skip to content

Commit 343fda9

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
serial: mxs-auart: properly handle mctrl_gpio failing
If mctrl_gpio_init returns an error code this value should be forwarded and the driver must not simply ignore this failure. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f059a45 commit 343fda9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/tty/serial/mxs-auart.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,14 +1155,14 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
11551155
return 0;
11561156
}
11571157

1158-
static bool mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
1158+
static int mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
11591159
{
11601160
enum mctrl_gpio_idx i;
11611161
struct gpio_desc *gpiod;
11621162

11631163
s->gpios = mctrl_gpio_init(dev, 0);
1164-
if (IS_ERR_OR_NULL(s->gpios))
1165-
return false;
1164+
if (IS_ERR(s->gpios))
1165+
return PTR_ERR(s->gpios);
11661166

11671167
/* Block (enabled before) DMA option if RTS or CTS is GPIO line */
11681168
if (!RTS_AT_AUART() || !CTS_AT_AUART()) {
@@ -1180,7 +1180,7 @@ static bool mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
11801180
s->gpio_irq[i] = -EINVAL;
11811181
}
11821182

1183-
return true;
1183+
return 0;
11841184
}
11851185

11861186
static void mxs_auart_free_gpio_irq(struct mxs_auart_port *s)
@@ -1276,9 +1276,11 @@ static int mxs_auart_probe(struct platform_device *pdev)
12761276

12771277
platform_set_drvdata(pdev, s);
12781278

1279-
if (!mxs_auart_init_gpios(s, &pdev->dev))
1280-
dev_err(&pdev->dev,
1281-
"Failed to initialize GPIOs. The serial port may not work as expected\n");
1279+
ret = mxs_auart_init_gpios(s, &pdev->dev);
1280+
if (ret) {
1281+
dev_err(&pdev->dev, "Failed to initialize GPIOs.\n");
1282+
got out_free_irq;
1283+
}
12821284

12831285
/*
12841286
* Get the GPIO lines IRQ

0 commit comments

Comments
 (0)