[PATCH] clocksource: fix a missing check of clk_prepare

From: Kangjie Lu
Date: Tue Dec 25 2018 - 21:52:02 EST


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

Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
---
drivers/clocksource/sh_cmt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 55d3e03f2cd4..60a70832cfa9 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -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);
}

--
2.17.2 (Apple Git-113)