Skip to contentSkip to conversation

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

PATCH In review Li Zhong 2 participants 2 messages Sep 19, 2022

Subsystems (2)
lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 drivers/tty/serial/8250: check the return value of clk_prepare_enable()

Check the return value of clk_prepare_enable() which could fail when cannot enable the clock.

---
 drivers/tty/serial/8250/8250_of.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_of.c +2 -1
index 1b461fba15a3..23e9b9e8c940 100644
@@ -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);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 13 lines · Li Zhong

Check the return value of clk_prepare_enable() which could fail when cannot enable the clock.

---
 drivers/tty/serial/8250/8250_of.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_of.c +0 -0
index 1b461fba15a3..23e9b9e8c940 100644

drivers/tty/serial/8250/8250_of.c static int of_serial_resume(struct device *dev) · line 302

Quoted 6 lines
drivers/tty/serial/8250/8250_of.c +2 -1
@@ -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 :(