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 <fabio.estevam@nxp.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
15210ad18f
commit
dd0a18ca4c
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue