Commit dd0a18ca authored by Fabio Estevam's avatar Fabio Estevam Committed by Wim Van Sebroeck

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: default avatarFabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 15210ad1
...@@ -136,7 +136,9 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) ...@@ -136,7 +136,9 @@ static int bcm7038_wdt_probe(struct platform_device *pdev)
wdt->clk = devm_clk_get(dev, NULL); wdt->clk = devm_clk_get(dev, NULL);
/* If unable to get clock, use default frequency */ /* If unable to get clock, use default frequency */
if (!IS_ERR(wdt->clk)) { 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); wdt->rate = clk_get_rate(wdt->clk);
/* Prevent divide-by-zero exception */ /* Prevent divide-by-zero exception */
if (!wdt->rate) if (!wdt->rate)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment