summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2015-02-12 14:24:38 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-07 02:15:03 (GMT)
commit722ccf416ac2804cdb9b5c84e81524fab775a577 (patch)
tree42c8497180440a599697cd6b41327ecb4f815b30 /drivers/tty
parentc89b73703ea3e61ab233560d2c6c4fc0963111dc (diff)
downloadlinux-722ccf416ac2804cdb9b5c84e81524fab775a577.tar.xz
serial: atmel: fix error handling when mctrl_gpio_init fails
mctrl_gpio_init at present doesn't return NULL. (It might be used in the future when no gpios are to be used indicating success.) Properly pass error returned and also make driver probing fail on error. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/atmel_serial.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 846552b..4031dc3 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2542,8 +2542,8 @@ static int atmel_init_gpios(struct atmel_uart_port *p, struct device *dev)
struct gpio_desc *gpiod;
p->gpios = mctrl_gpio_init(dev, 0);
- if (IS_ERR_OR_NULL(p->gpios))
- return -1;
+ if (IS_ERR(p->gpios))
+ return PTR_ERR(p->gpios);
for (i = 0; i < UART_GPIO_MAX; i++) {
gpiod = mctrl_gpio_to_gpiod(p->gpios, i);
@@ -2594,9 +2594,10 @@ static int atmel_serial_probe(struct platform_device *pdev)
port->uart.line = ret;
ret = atmel_init_gpios(port, &pdev->dev);
- if (ret < 0)
- dev_err(&pdev->dev, "%s",
- "Failed to initialize GPIOs. The serial port may not work as expected");
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Failed to initialize GPIOs.");
+ goto err;
+ }
ret = atmel_init_port(port, pdev);
if (ret)