* [PATCH] serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init()
@ 2022-11-25 10:11 Yi Yang
2022-11-25 11:19 ` Christophe JAILLET
0 siblings, 1 reply; 3+ messages in thread
From: Yi Yang @ 2022-11-25 10:11 UTC (permalink / raw)
To: ldewangan, gregkh, jirislaby, thierry.reding, jonathanh,
kyarlagadda, yiyang13
Cc: linux-serial, linux-tegra, linux-kernel
Add the missing clk_disable_unprepare() before return from
tegra_uart_hw_init() in the error handling path.
Fixes: cc9ca4d95846 ("serial: tegra: Only print FIFO error message when an error occurs")
Fixes: d781ec21bae6 ("serial: tegra: report clk rate errors")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
drivers/tty/serial/serial-tegra.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index e5b9773db5e3..abc5039eb273 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -1046,6 +1046,7 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
if (tup->cdata->fifo_mode_enable_status) {
ret = tegra_uart_wait_fifo_mode_enabled(tup);
if (ret < 0) {
+ clk_disable_unprepare(tup->uart_clk);
dev_err(tup->uport.dev,
"Failed to enable FIFO mode: %d\n", ret);
return ret;
@@ -1067,6 +1068,7 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
*/
ret = tegra_set_baudrate(tup, TEGRA_UART_DEFAULT_BAUD);
if (ret < 0) {
+ clk_disable_unprepare(tup->uart_clk);
dev_err(tup->uport.dev, "Failed to set baud rate\n");
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init()
2022-11-25 10:11 [PATCH] serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init() Yi Yang
@ 2022-11-25 11:19 ` Christophe JAILLET
2022-11-26 2:24 ` yiyang (D)
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2022-11-25 11:19 UTC (permalink / raw)
To: yiyang13
Cc: gregkh, jirislaby, jonathanh, kyarlagadda, ldewangan,
linux-kernel, linux-serial, linux-tegra, thierry.reding
Le 25/11/2022 à 11:11, Yi Yang a écrit :
> Add the missing clk_disable_unprepare() before return from
> tegra_uart_hw_init() in the error handling path.
>
> Fixes: cc9ca4d95846 ("serial: tegra: Only print FIFO error message when an error occurs")
> Fixes: d781ec21bae6 ("serial: tegra: report clk rate errors")
> Signed-off-by: Yi Yang <yiyang13-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> drivers/tty/serial/serial-tegra.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Hi,
I think that it is also missing in tegra_uart_startup() if an error
occurs after a successful tegra_uart_hw_init() call.
Or maybe (based on function mane) tegra_uart_hw_deinit() should called
there.
Just my 2c.
CJ
> diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
> index e5b9773db5e3..abc5039eb273 100644
> --- a/drivers/tty/serial/serial-tegra.c
> +++ b/drivers/tty/serial/serial-tegra.c
> @@ -1046,6 +1046,7 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
> if (tup->cdata->fifo_mode_enable_status) {
> ret = tegra_uart_wait_fifo_mode_enabled(tup);
> if (ret < 0) {
> + clk_disable_unprepare(tup->uart_clk);
> dev_err(tup->uport.dev,
> "Failed to enable FIFO mode: %d\n", ret);
> return ret;
> @@ -1067,6 +1068,7 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
> */
> ret = tegra_set_baudrate(tup, TEGRA_UART_DEFAULT_BAUD);
> if (ret < 0) {
> + clk_disable_unprepare(tup->uart_clk);
> dev_err(tup->uport.dev, "Failed to set baud rate\n");
> return ret;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init()
2022-11-25 11:19 ` Christophe JAILLET
@ 2022-11-26 2:24 ` yiyang (D)
0 siblings, 0 replies; 3+ messages in thread
From: yiyang (D) @ 2022-11-26 2:24 UTC (permalink / raw)
To: Christophe JAILLET
Cc: gregkh, jirislaby, jonathanh, kyarlagadda, ldewangan,
linux-kernel, linux-serial, linux-tegra, thierry.reding
On 2022/11/25 19:19, Christophe JAILLET wrote:
> Le 25/11/2022 à 11:11, Yi Yang a écrit :
>> Add the missing clk_disable_unprepare() before return from
>> tegra_uart_hw_init() in the error handling path.
>>
>> Fixes: cc9ca4d95846 ("serial: tegra: Only print FIFO error message
>> when an error occurs")
>> Fixes: d781ec21bae6 ("serial: tegra: report clk rate errors")
>> Signed-off-by: Yi Yang <yiyang13-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> ---
>> drivers/tty/serial/serial-tegra.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>
> Hi,
>
> I think that it is also missing in tegra_uart_startup() if an error
> occurs after a successful tegra_uart_hw_init() call.
>
> Or maybe (based on function mane) tegra_uart_hw_deinit() should called
> there.
>
> Just my 2c.
>
> CJ
>
Thanks! I will fix it in v2 patch.
>
>> diff --git a/drivers/tty/serial/serial-tegra.c
>> b/drivers/tty/serial/serial-tegra.c
>> index e5b9773db5e3..abc5039eb273 100644
>> --- a/drivers/tty/serial/serial-tegra.c
>> +++ b/drivers/tty/serial/serial-tegra.c
>> @@ -1046,6 +1046,7 @@ static int tegra_uart_hw_init(struct
>> tegra_uart_port *tup)
>> if (tup->cdata->fifo_mode_enable_status) {
>> ret = tegra_uart_wait_fifo_mode_enabled(tup);
>> if (ret < 0) {
>> + clk_disable_unprepare(tup->uart_clk);
>> dev_err(tup->uport.dev,
>> "Failed to enable FIFO mode: %d\n", ret);
>> return ret;
>> @@ -1067,6 +1068,7 @@ static int tegra_uart_hw_init(struct
>> tegra_uart_port *tup)
>> */
>> ret = tegra_set_baudrate(tup, TEGRA_UART_DEFAULT_BAUD);
>> if (ret < 0) {
>> + clk_disable_unprepare(tup->uart_clk);
>> dev_err(tup->uport.dev, "Failed to set baud rate\n");
>> return ret;
>> }
>
> .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-26 2:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 10:11 [PATCH] serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init() Yi Yang
2022-11-25 11:19 ` Christophe JAILLET
2022-11-26 2:24 ` yiyang (D)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.