/* Not all platforms can gate the clock, so it is not
an error if the clock does not exists. */
info->clk = devm_clk_get(&pdev->dev, NULL);
- if (!IS_ERR(info->clk))
- clk_prepare_enable(info->clk);
+ if (IS_ERR(info->clk)) {
+ ret = PTR_ERR(info->clk);
+ if (ret == -ENOENT) {
+ info->clk = NULL;
+ } else {
+ dev_err(&pdev->dev, "failed to get clock!\n");
+ return ret;
+ }
+ }
+
+ clk_prepare_enable(info->clk);
ret = nand_scan(mtd, 1);
if (ret)
return 0;
no_dev:
- if (!IS_ERR(info->clk))
- clk_disable_unprepare(info->clk);
-
+ clk_disable_unprepare(info->clk);
return ret;
}
nand_release(mtd);
- if (!IS_ERR(info->clk))
- clk_disable_unprepare(info->clk);
+ clk_disable_unprepare(info->clk);
return 0;
}