Skip to contentSkip to conversation

clk: fix clk_get_bulk when phandle error

PATCH New Neil Armstrong 1 participant 1 message Apr 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/clk/clk-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-uclass.c +2 -2
index 6e99b3b..53f418b 100644
@@ -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)
Signature · 1 line
2.7.4