[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220630140919.3857698-1-yangyingliang@huawei.com>
Date: Thu, 30 Jun 2022 22:09:18 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-serial@...r.kernel.org>
CC: <gregkh@...uxfoundation.org>, <geert+renesas@...der.be>,
<peter@...leysoftware.com>, <sjoerd.simons@...labora.co.uk>
Subject: [PATCH 1/2] serial: sh-sci: fix missing sci_cleanup_single() in sci_probe_single()
Add missing sci_cleanup_single() in error case in sci_probe_single()
Fixes: f907c9ea8835 ("serial: sh-sci: Add support for GPIO-controlled modem lines")
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/tty/serial/sh-sci.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 0075a1420005..ca5a58f01aff 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3283,25 +3283,31 @@ static int sci_probe_single(struct platform_device *dev,
return ret;
sciport->gpios = mctrl_gpio_init(&sciport->port, 0);
- if (IS_ERR(sciport->gpios))
- return PTR_ERR(sciport->gpios);
+ if (IS_ERR(sciport->gpios)) {
+ ret = PTR_ERR(sciport->gpios);
+ goto err_cleanup_single;
+ }
if (sciport->has_rtscts) {
if (mctrl_gpio_to_gpiod(sciport->gpios, UART_GPIO_CTS) ||
mctrl_gpio_to_gpiod(sciport->gpios, UART_GPIO_RTS)) {
dev_err(&dev->dev, "Conflicting RTS/CTS config\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_cleanup_single;
}
sciport->port.flags |= UPF_HARD_FLOW;
}
ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
- if (ret) {
- sci_cleanup_single(sciport);
- return ret;
- }
+ if (ret)
+ goto err_cleanup_single;
return 0;
+
+err_cleanup_single:
+ sci_cleanup_single(sciport);
+
+ return ret;
}
static int sci_probe(struct platform_device *dev)
--
2.25.1
Powered by blists - more mailing lists