Skip to content

Commit 7f81c24

Browse files
anderssonbebarino
authored andcommitted
clk: Make clk_bulk_get_all() return a valid "id"
The adreno driver expects the "id" field of the returned clk_bulk_data to be filled in with strings from the clock-names property. But due to the use of kmalloc_array() in of_clk_bulk_get_all() it receives a list of bogus pointers instead. Zero-initialize the "id" field and attempt to populate with strings from the clock-names property to resolve both these issues. Fixes: 616e45d ("clk: add new APIs to operate on all available clocks") Fixes: 8e3e791 ("drm/msm: Use generic bulk clock function") Cc: Dong Aisheng <aisheng.dong@nxp.com> Cc: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lkml.kernel.org/r/20190913024029.2640-1-bjorn.andersson@linaro.org Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 5f9e832 commit 7f81c24

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/clk/clk-bulk.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
1818
int ret;
1919
int i;
2020

21-
for (i = 0; i < num_clks; i++)
21+
for (i = 0; i < num_clks; i++) {
22+
clks[i].id = NULL;
2223
clks[i].clk = NULL;
24+
}
2325

2426
for (i = 0; i < num_clks; i++) {
27+
of_property_read_string_index(np, "clock-names", i, &clks[i].id);
2528
clks[i].clk = of_clk_get(np, i);
2629
if (IS_ERR(clks[i].clk)) {
2730
ret = PTR_ERR(clks[i].clk);

0 commit comments

Comments
 (0)