[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1577790048-18263-2-git-send-email-tdas@codeaurora.org>
Date: Tue, 31 Dec 2019 16:30:47 +0530
From: Taniya Das <tdas@...eaurora.org>
To: Stephen Boyd <sboyd@...nel.org>,
Michael Turquette <mturquette@...libre.com>
Cc: David Brown <david.brown@...aro.org>,
Rajendra Nayak <rnayak@...eaurora.org>,
linux-arm-msm@...r.kernel.org, linux-soc@...r.kernel.org,
linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
Taniya Das <tdas@...eaurora.org>
Subject: [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering
When iterating over a platform's available clocks in clk_rpmh_probe(),
check for undefined (null) entries in the clocks array. Not all
clock indexes necessarily have clocks defined. Also remove referencing
the clock name before valid hardware.
Signed-off-by: Taniya Das <tdas@...eaurora.org>
---
drivers/clk/qcom/clk-rpmh.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index 7ed313a..05cbe6f 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -431,11 +431,13 @@ static int clk_rpmh_probe(struct platform_device *pdev)
hw_clks = desc->clks;
for (i = 0; i < desc->num_clks; i++) {
- const char *name = hw_clks[i]->init->name;
u32 res_addr;
size_t aux_data_len;
const struct bcm_db *data;
+ if (!hw_clks[i])
+ continue;
+
rpmh_clk = to_clk_rpmh(hw_clks[i]);
res_addr = cmd_db_read_addr(rpmh_clk->res_name);
if (!res_addr) {
@@ -462,7 +464,8 @@ static int clk_rpmh_probe(struct platform_device *pdev)
ret = devm_clk_hw_register(&pdev->dev, hw_clks[i]);
if (ret) {
- dev_err(&pdev->dev, "failed to register %s\n", name);
+ dev_err(&pdev->dev, "failed to register %s\n",
+ hw_clks[i]->init->name);
return ret;
}
}
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the Linux Foundation.
Powered by blists - more mailing lists