Commit 7f81c242 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Stephen Boyd

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: 616e45df ("clk: add new APIs to operate on all available clocks")
Fixes: 8e3e791d ("drm/msm: Use generic bulk clock function")
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lkml.kernel.org/r/20190913024029.2640-1-bjorn.andersson@linaro.orgReviewed-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 5f9e832c
...@@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, ...@@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
int ret; int ret;
int i; int i;
for (i = 0; i < num_clks; i++) for (i = 0; i < num_clks; i++) {
clks[i].id = NULL;
clks[i].clk = NULL; clks[i].clk = NULL;
}
for (i = 0; i < num_clks; i++) { for (i = 0; i < num_clks; i++) {
of_property_read_string_index(np, "clock-names", i, &clks[i].id);
clks[i].clk = of_clk_get(np, i); clks[i].clk = of_clk_get(np, i);
if (IS_ERR(clks[i].clk)) { if (IS_ERR(clks[i].clk)) {
ret = PTR_ERR(clks[i].clk); ret = PTR_ERR(clks[i].clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment