Commit ada80043 authored by Fabrice Gasnier's avatar Fabrice Gasnier Committed by Greg Kroah-Hartman

serial: stm32: fix error handling in probe

Disable clock properly in case of error.
Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: default avatarBich Hemon <bich.hemon@st.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 35abe98f
...@@ -678,8 +678,10 @@ static int stm32_init_port(struct stm32_port *stm32port, ...@@ -678,8 +678,10 @@ static int stm32_init_port(struct stm32_port *stm32port,
return ret; return ret;
stm32port->port.uartclk = clk_get_rate(stm32port->clk); stm32port->port.uartclk = clk_get_rate(stm32port->clk);
if (!stm32port->port.uartclk) if (!stm32port->port.uartclk) {
clk_disable_unprepare(stm32port->clk);
ret = -EINVAL; ret = -EINVAL;
}
return ret; return ret;
} }
...@@ -865,7 +867,7 @@ static int stm32_serial_probe(struct platform_device *pdev) ...@@ -865,7 +867,7 @@ static int stm32_serial_probe(struct platform_device *pdev)
ret = uart_add_one_port(&stm32_usart_driver, &stm32port->port); ret = uart_add_one_port(&stm32_usart_driver, &stm32port->port);
if (ret) if (ret)
return ret; goto err_uninit;
ret = stm32_of_dma_rx_probe(stm32port, pdev); ret = stm32_of_dma_rx_probe(stm32port, pdev);
if (ret) if (ret)
...@@ -878,6 +880,11 @@ static int stm32_serial_probe(struct platform_device *pdev) ...@@ -878,6 +880,11 @@ static int stm32_serial_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, &stm32port->port); platform_set_drvdata(pdev, &stm32port->port);
return 0; return 0;
err_uninit:
clk_disable_unprepare(stm32port->clk);
return ret;
} }
static int stm32_serial_remove(struct platform_device *pdev) static int stm32_serial_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment