clk: qcom: rpmh: skip undefined clocks when registering
authorTaniya Das <tdas@codeaurora.org>
Mon, 6 Jan 2020 10:18:42 +0000 (15:48 +0530)
committerStephen Boyd <sboyd@kernel.org>
Mon, 6 Jan 2020 16:53:44 +0000 (08:53 -0800)
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.

Signed-off-by: Taniya Das <tdas@codeaurora.org>
Link: https://lkml.kernel.org/r/1578305923-29125-2-git-send-email-tdas@codeaurora.org
[sboyd@kernel.org: Leave 'name' declaration at beginning of loop]
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/qcom/clk-rpmh.c

index 7ed313ad6e43d6dea02af4900a1b303e90b80bce..a12ce8da2d00fcac380bb495e1fc64fa63508880 100644 (file)
@@ -431,11 +431,16 @@ 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;
+               const char *name;
                u32 res_addr;
                size_t aux_data_len;
                const struct bcm_db *data;
 
+               if (!hw_clks[i])
+                       continue;
+
+               name = hw_clks[i]->init->name;
+
                rpmh_clk = to_clk_rpmh(hw_clks[i]);
                res_addr = cmd_db_read_addr(rpmh_clk->res_name);
                if (!res_addr) {