diff options
author | Fabrice Gasnier <fabrice.gasnier@st.com> | 2017-07-13 18:08:29 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-30 17:32:31 +0300 |
commit | ada8004374afc35cc3b450dec35fb53531570e7b (patch) | |
tree | 3e8821c22687bac9ad09e2f7a996e24bb745a382 /drivers/tty/serial/stm32-usart.c | |
parent | 35abe98f15ed60d252f79da6e41b477527af8b2f (diff) | |
download | linux-ada8004374afc35cc3b450dec35fb53531570e7b.tar.xz |
serial: stm32: fix error handling in probe
Disable clock properly in case of error.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Bich Hemon <bich.hemon@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/stm32-usart.c')
-rw-r--r-- | drivers/tty/serial/stm32-usart.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 2fca2d2a83cc..688afc4fb714 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -678,8 +678,10 @@ static int stm32_init_port(struct stm32_port *stm32port, return ret; stm32port->port.uartclk = clk_get_rate(stm32port->clk); - if (!stm32port->port.uartclk) + if (!stm32port->port.uartclk) { + clk_disable_unprepare(stm32port->clk); ret = -EINVAL; + } return ret; } @@ -865,7 +867,7 @@ static int stm32_serial_probe(struct platform_device *pdev) ret = uart_add_one_port(&stm32_usart_driver, &stm32port->port); if (ret) - return ret; + goto err_uninit; ret = stm32_of_dma_rx_probe(stm32port, pdev); if (ret) @@ -878,6 +880,11 @@ static int stm32_serial_probe(struct platform_device *pdev) platform_set_drvdata(pdev, &stm32port->port); return 0; + +err_uninit: + clk_disable_unprepare(stm32port->clk); + + return ret; } static int stm32_serial_remove(struct platform_device *pdev) |