diff options
Diffstat (limited to 'drivers/soc/rockchip')
-rw-r--r-- | drivers/soc/rockchip/pm_domains.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index ad96ddeaeb78..53efc386b1ad 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -402,11 +402,16 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, pd->num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells"); - - pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, sizeof(*pd->clks), - GFP_KERNEL); - if (!pd->clks) - return -ENOMEM; + if (pd->num_clks > 0) { + pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, + sizeof(*pd->clks), GFP_KERNEL); + if (!pd->clks) + return -ENOMEM; + } else { + dev_dbg(pmu->dev, "%s: doesn't have clocks: %d\n", + node->name, pd->num_clks); + pd->num_clks = 0; + } for (i = 0; i < pd->num_clks; i++) { pd->clks[i].clk = of_clk_get(node, i); |