aboutsummaryrefslogtreecommitdiff
path: root/drivers/clk/clk-uclass.c
diff options
context:
space:
mode:
authorNeil Armstrong <narmstrong@baylibre.com>2018-04-17 11:30:31 +0200
committerTom Rini <trini@konsulko.com>2018-04-17 17:45:08 -0400
commit721881c4178dc5ca1f201c9d9f8e86d32499666f (patch)
tree824622ee9450245208b4ef056c2267079559b635 /drivers/clk/clk-uclass.c
parent895a82ce90278130828b26c230da99331a33e729 (diff)
downloadu-boot-721881c4178dc5ca1f201c9d9f8e86d32499666f.zip
u-boot-721881c4178dc5ca1f201c9d9f8e86d32499666f.tar.gz
u-boot-721881c4178dc5ca1f201c9d9f8e86d32499666f.tar.bz2
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 <narmstrong@baylibre.com>
Diffstat (limited to 'drivers/clk/clk-uclass.c')
-rw-r--r--drivers/clk/clk-uclass.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 6e99b3b..53f418b 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)