From: Chunfeng Yun Date: Thu, 9 Jan 2020 03:35:05 +0000 (+0800) Subject: clk: fix error check for devm_clk_get_optional() X-Git-Tag: v2020.04-rc1~21^2~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0f9b2b3ddf36d4bf69011a0dddefa10091cee60d;p=oweals%2Fu-boot.git clk: fix error check for devm_clk_get_optional() 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 Reviewed-by: Simon Glass Reviewed-by: Ryder Lee --- diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 9aa8537004..2778b504c0 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -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;