From: Neil Armstrong Date: Tue, 17 Apr 2018 09:30:31 +0000 (+0200) Subject: clk: fix clk_get_bulk when phandle error X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=721881c4178dc5ca1f201c9d9f8e86d32499666f;p=u-boot.git clk: fix clk_get_bulk when phandle error This fixes the Coverity Defect CID 175347 when dev_count_phandle_with_args() returns a negative value. Fixes: a855be87da49 ("clk: Add get/enable/disable/release for a bulk of clocks") Signed-off-by: Neil Armstrong --- diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 6e99b3b15d..53f418bfdd 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -111,8 +111,8 @@ int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk) bulk->count = 0; count = dev_count_phandle_with_args(dev, "clocks", "#clock-cells"); - if (!count) - return 0; + if (count < 1) + return count; bulk->clks = devm_kcalloc(dev, count, sizeof(struct clk), GFP_KERNEL); if (!bulk->clks)