From dd0a18ca4cbdce00bc2b2e0510793205af27c7c5 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Sat, 22 Jul 2017 17:22:59 -0300 Subject: watchdog: bcm7038: Check the return value from clk_prepare_enable() clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam Reviewed-by: Guenter Roeck Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/bcm7038_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/watchdog') diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c index c1b8e534fb55..f88f546e8050 100644 --- a/drivers/watchdog/bcm7038_wdt.c +++ b/drivers/watchdog/bcm7038_wdt.c @@ -136,7 +136,9 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) wdt->clk = devm_clk_get(dev, NULL); /* If unable to get clock, use default frequency */ if (!IS_ERR(wdt->clk)) { - clk_prepare_enable(wdt->clk); + err = clk_prepare_enable(wdt->clk); + if (err) + return err; wdt->rate = clk_get_rate(wdt->clk); /* Prevent divide-by-zero exception */ if (!wdt->rate) -- cgit v1.2.1