diff mbox series

[v1] drivers/tty/serial/8250: check the return value of clk_prepare_enable()

Message ID 20220919085455.1582310-1-floridsleeves@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v1] drivers/tty/serial/8250: check the return value of clk_prepare_enable() | expand

Commit Message

Li Zhong Sept. 19, 2022, 8:54 a.m. UTC
Check the return value of clk_prepare_enable() which could fail when
cannot enable the clock.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 drivers/tty/serial/8250/8250_of.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Greg KH Sept. 19, 2022, 9:32 a.m. UTC | #1
On Mon, Sep 19, 2022 at 01:54:55AM -0700, Li Zhong wrote:
> Check the return value of clk_prepare_enable() which could fail when
> cannot enable the clock.
> 
> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
>  drivers/tty/serial/8250/8250_of.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
> index 1b461fba15a3..23e9b9e8c940 100644
> --- a/drivers/tty/serial/8250/8250_of.c
> +++ b/drivers/tty/serial/8250/8250_of.c
> @@ -298,7 +298,8 @@ static int of_serial_resume(struct device *dev)
>  
>  	if (!uart_console(port) || console_suspend_enabled) {
>  		pm_runtime_get_sync(dev);
> -		clk_prepare_enable(info->clk);
> +		if (clk_prepare_enable(info->clk) < 0)
> +			dev_warn(dev, "can't enable clk.\n");

Again, you check but do nothing with the error :(
diff mbox series

Patch

diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 1b461fba15a3..23e9b9e8c940 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -298,7 +298,8 @@  static int of_serial_resume(struct device *dev)
 
 	if (!uart_console(port) || console_suspend_enabled) {
 		pm_runtime_get_sync(dev);
-		clk_prepare_enable(info->clk);
+		if (clk_prepare_enable(info->clk) < 0)
+			dev_warn(dev, "can't enable clk.\n");
 	}
 
 	serial8250_resume_port(info->line);