summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2019-09-12 19:40:29 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-07 18:59:21 +0200
commit04dddb1ca7addcd6f7ddd713f9f7b5dcc6062069 (patch)
tree4b521abb4ca36c833633ea03ccaa80da8fa0b1b1
parentb6185efcf24102dae658b9c3c25bae9922460537 (diff)
downloadlinux-stable-04dddb1ca7addcd6f7ddd713f9f7b5dcc6062069.tar.gz
linux-stable-04dddb1ca7addcd6f7ddd713f9f7b5dcc6062069.tar.bz2
linux-stable-04dddb1ca7addcd6f7ddd713f9f7b5dcc6062069.zip
clk: Make clk_bulk_get_all() return a valid "id"
[ Upstream commit 7f81c2426587b34bf73e643c1a6d080dfa14cf8a ] 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: 616e45df7c4a ("clk: add new APIs to operate on all available clocks") Fixes: 8e3e791d20d2 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/clk/clk-bulk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index 06499568cf07..db5096fa9a17 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -18,10 +18,13 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
int ret;
int i;
- for (i = 0; i < num_clks; i++)
+ for (i = 0; i < num_clks; i++) {
+ clks[i].id = NULL;
clks[i].clk = NULL;
+ }
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);
if (IS_ERR(clks[i].clk)) {
ret = PTR_ERR(clks[i].clk);