Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

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>

authored by

Taniya Das and committed by
Stephen Boyd
924e2d01 253dc75a

+6 -1
+6 -1
drivers/clk/qcom/clk-rpmh.c
··· 431 431 hw_clks = desc->clks; 432 432 433 433 for (i = 0; i < desc->num_clks; i++) { 434 - const char *name = hw_clks[i]->init->name; 434 + const char *name; 435 435 u32 res_addr; 436 436 size_t aux_data_len; 437 437 const struct bcm_db *data; 438 + 439 + if (!hw_clks[i]) 440 + continue; 441 + 442 + name = hw_clks[i]->init->name; 438 443 439 444 rpmh_clk = to_clk_rpmh(hw_clks[i]); 440 445 res_addr = cmd_db_read_addr(rpmh_clk->res_name);