[PATCH 1/1] clocksource/drivers/integrator: check return value
From: Xidong Wang
Date: Wed May 29 2019 - 04:42:48 EST
In integrator_ap_timer_init_of(), the return value of
clk_prepare_enable() should be checked before clk is used.
Signed-off-by: Xidong Wang <wangxidong_97@xxxxxxx>
---
drivers/clocksource/timer-integrator-ap.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c
index 19fb7de..72d5bdc 100644
--- a/drivers/clocksource/timer-integrator-ap.c
+++ b/drivers/clocksource/timer-integrator-ap.c
@@ -177,6 +177,7 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
{
const char *path;
void __iomem *base;
+ int ret;
int err;
int irq;
struct clk *clk;
@@ -192,7 +193,10 @@ static int __init integrator_ap_timer_init_of(struct device_node *node)
pr_err("No clock for %pOFn\n", node);
return PTR_ERR(clk);
}
- clk_prepare_enable(clk);
+ ret = clk_prepare_enable(clk);
+ if (ret) {
+ return ret;
+ }
rate = clk_get_rate(clk);
writel(0, base + TIMER_CTRL);
--
2.7.4