linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] drivers/tty/serial/8250: check the return value of clk_prepare_enable()
@ 2022-09-19  8:54 Li Zhong
  2022-09-19  9:32 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zhong @ 2022-09-19  8:54 UTC (permalink / raw)
  To: linux-kernel, linux-mediatek, linux-arm-kernel, linux-serial
  Cc: etremblay, l.sanfilippo, u.kleine-koenig, robert.hancock,
	ilpo.jarvinen, matthias.bgg, p.zabel, jirislaby, Li Zhong

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");
 	}
 
 	serial8250_resume_port(info->line);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] drivers/tty/serial/8250: check the return value of clk_prepare_enable()
  2022-09-19  8:54 [PATCH v1] drivers/tty/serial/8250: check the return value of clk_prepare_enable() Li Zhong
@ 2022-09-19  9:32 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2022-09-19  9:32 UTC (permalink / raw)
  To: Li Zhong
  Cc: linux-kernel, linux-mediatek, linux-arm-kernel, linux-serial,
	etremblay, l.sanfilippo, u.kleine-koenig, robert.hancock,
	ilpo.jarvinen, matthias.bgg, p.zabel, jirislaby

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 :(

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-19  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-19  8:54 [PATCH v1] drivers/tty/serial/8250: check the return value of clk_prepare_enable() Li Zhong
2022-09-19  9:32 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).