clk: fix error check for devm_clk_get_optional()
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Thu, 9 Jan 2020 03:35:05 +0000 (11:35 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 16 Jan 2020 14:39:45 +0000 (09:39 -0500)
If skip all return error number, it may skip some real error cases,
so only skip the error when the clock is not provided in DTS

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
drivers/clk/clk-uclass.c

index 9aa8537004a339ce910751bedafdf0d4ee9ea50c..2778b504c0f8754e81c6b7e602148131d6fe37d9 100644 (file)
@@ -678,7 +678,7 @@ struct clk *devm_clk_get_optional(struct udevice *dev, const char *id)
 {
        struct clk *clk = devm_clk_get(dev, id);
 
-       if (IS_ERR(clk))
+       if (PTR_ERR(clk) == -ENODATA)
                return NULL;
 
        return clk;