aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManivannan Sadhasivam <mani@kernel.org>2020-04-19 21:04:26 +0530
committerManivannan Sadhasivam <mani@kernel.org>2020-04-19 23:15:02 +0530
commit5c4c72b5cfe57b0ddaa9a36cfdda063fcc2e62d4 (patch)
tree9c963958785fd8b87c7632f1d4f7b8249cfbab8a
parent09c3ffc86173b584bd0033ba0ddcc8c4490ae849 (diff)
download96b-common-5c4c72b5cfe57b0ddaa9a36cfdda063fcc2e62d4.tar.gz
serialstinger96
-rw-r--r--drivers/tty/serial/stm32-usart.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 026982259714..17c2f3276888 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -518,7 +518,7 @@ static void stm32_set_mctrl(struct uart_port *port, unsigned int mctrl)
static unsigned int stm32_get_mctrl(struct uart_port *port)
{
struct stm32_port *stm32_port = to_stm32_port(port);
- int ret;
+ unsigned int ret;
/* This routine is used to get signals of: DCD, DSR, RI, and CTS */
ret = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
@@ -988,24 +988,32 @@ static int stm32_init_port(struct stm32_port *stm32port,
stm32port->port.uartclk = clk_get_rate(stm32port->clk);
if (!stm32port->port.uartclk) {
- clk_disable_unprepare(stm32port->clk);
ret = -EINVAL;
+ goto err_clk;
}
stm32port->gpios = mctrl_gpio_init(&stm32port->port, 0);
- if (IS_ERR(stm32port->gpios))
- return PTR_ERR(stm32port->gpios);
+ if (IS_ERR(stm32port->gpios)) {
+ ret = PTR_ERR(stm32port->gpios);
+ goto err_clk;
+ }
/* Both CTS/RTS gpios and "st,hw-flow-ctrl" should not be specified */
if (stm32port->hw_flow_control) {
if (mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_CTS) ||
mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_RTS)) {
dev_err(&pdev->dev, "Conflicting RTS/CTS config\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_clk;
}
}
return ret;
+
+err_clk:
+ clk_disable_unprepare(stm32port->clk);
+
+ return ret;
}
static struct stm32_port *stm32_of_get_stm32_port(struct platform_device *pdev)