Skip to content
Snippets Groups Projects
Commit 721881c4 authored by Neil Armstrong's avatar Neil Armstrong Committed by Tom Rini
Browse files

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: a855be87 ("clk: Add get/enable/disable/release for a bulk of clocks")
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
parent 895a82ce
No related branches found
No related tags found
No related merge requests found
...@@ -111,8 +111,8 @@ int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk) ...@@ -111,8 +111,8 @@ int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)
bulk->count = 0; bulk->count = 0;
count = dev_count_phandle_with_args(dev, "clocks", "#clock-cells"); count = dev_count_phandle_with_args(dev, "clocks", "#clock-cells");
if (!count) if (count < 1)
return 0; return count;
bulk->clks = devm_kcalloc(dev, count, sizeof(struct clk), GFP_KERNEL); bulk->clks = devm_kcalloc(dev, count, sizeof(struct clk), GFP_KERNEL);
if (!bulk->clks) if (!bulk->clks)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment