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>
This commit is contained in:
parent
f059a455fc
commit
343fda9548
@ -1155,14 +1155,14 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
|
static int mxs_auart_init_gpios(struct mxs_auart_port *s, struct device *dev)
|
||||||
{
|
{
|
||||||
enum mctrl_gpio_idx i;
|
enum mctrl_gpio_idx i;
|
||||||
struct gpio_desc *gpiod;
|
struct gpio_desc *gpiod;
|
||||||
|
|
||||||
s->gpios = mctrl_gpio_init(dev, 0);
|
s->gpios = mctrl_gpio_init(dev, 0);
|
||||||
if (IS_ERR_OR_NULL(s->gpios))
|
if (IS_ERR(s->gpios))
|
||||||
return false;
|
return PTR_ERR(s->gpios);
|
||||||
|
|
||||||
/* Block (enabled before) DMA option if RTS or CTS is GPIO line */
|
/* Block (enabled before) DMA option if RTS or CTS is GPIO line */
|
||||||
if (!RTS_AT_AUART() || !CTS_AT_AUART()) {
|
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)
|
|||||||
s->gpio_irq[i] = -EINVAL;
|
s->gpio_irq[i] = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mxs_auart_free_gpio_irq(struct mxs_auart_port *s)
|
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)
|
|||||||
|
|
||||||
platform_set_drvdata(pdev, s);
|
platform_set_drvdata(pdev, s);
|
||||||
|
|
||||||
if (!mxs_auart_init_gpios(s, &pdev->dev))
|
ret = mxs_auart_init_gpios(s, &pdev->dev);
|
||||||
dev_err(&pdev->dev,
|
if (ret) {
|
||||||
"Failed to initialize GPIOs. The serial port may not work as expected\n");
|
dev_err(&pdev->dev, "Failed to initialize GPIOs.\n");
|
||||||
|
got out_free_irq;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the GPIO lines IRQ
|
* Get the GPIO lines IRQ
|
||||||
|
Loading…
Reference in New Issue
Block a user