Skip to contentSkip to conversation

clocksource: fix a missing check of clk_prepare

PATCH New Kangjie Lu 1 participant 1 message Dec 26, 2018 Clocksource, clockevent drivers

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 clocksource: fix a missing check of clk_prepare

clk_prepare() could fail, so let's check its status, and if it fails, issue an error message.

---
 drivers/clocksource/sh_cmt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clocksource/sh_cmt.c +4 -1
index 55d3e03f2cd4..60a70832cfa9 100644
@@ -764,7 +764,10 @@ static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
 {
 	struct sh_cmt_channel *ch = ced_to_sh_cmt(ced);
 
-	clk_prepare(ch->cmt->clk);
+	if (clk_prepare(ch->cmt->clk))
+		dev_err(&ch->cmt->pdev->dev, "ch%u: failed to prepare clk\n",
+			ch->index);
+
 	pm_genpd_syscore_poweron(&ch->cmt->pdev->dev);
 }
 
Signature · 1 line
2.17.2 (Apple Git-113)