From: Fabio Estevam Date: Mon, 22 Jun 2015 04:16:18 +0000 (-0300) Subject: watchdog: imx2_wdt: Check for clk_prepare_enable() error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aefb163cb2b876bcbbceee47e3e4f22ed7364630;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git watchdog: imx2_wdt: Check for clk_prepare_enable() error 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: Wim Van Sebroeck --- diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index 2acdd17025c4..add1fa0fad17 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c @@ -260,7 +260,9 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) wdog->max_timeout = IMX2_WDT_MAX_TIME; wdog->parent = &pdev->dev; - clk_prepare_enable(wdev->clk); + ret = clk_prepare_enable(wdev->clk); + if (ret) + return ret; regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val); wdog->bootstatus = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0; @@ -365,8 +367,11 @@ static int imx2_wdt_resume(struct device *dev) { struct watchdog_device *wdog = dev_get_drvdata(dev); struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); + int ret; - clk_prepare_enable(wdev->clk); + ret = clk_prepare_enable(wdev->clk); + if (ret) + return ret; if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { /*