diff options
author | Tony Lindgren <tony@atomide.com> | 2018-11-15 14:46:52 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-13 08:51:23 +0100 |
commit | 65930054756acfbacddf6f80bd55a6f23a8937f6 (patch) | |
tree | fe855cd72c975070849ca797651e4a122e073dc0 /drivers/bus | |
parent | ed973f15f445352cd92efadfa47135c237561b5e (diff) |
bus: ti-sysc: Fix getting optional clocks in clock_roles
[ Upstream commit 7b4f8ac2f1acdff3c0cce23d8c3b86434a6e768a ]
We can have holes in clock_roles with interface clock missing for
example. Currently getting an optional clock will fail if there are
only a functional clock and an optional clock.
Fixes: 09dfe5810762 ("bus: ti-sysc: Add handling for clkctrl opt clocks")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/bus')
-rw-r--r-- | drivers/bus/ti-sysc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index 5b31131d0cba..b6f63e762021 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -217,8 +217,13 @@ static int sysc_get_clocks(struct sysc *ddata) if (!ddata->clocks) return -ENOMEM; - for (i = 0; i < ddata->nr_clocks; i++) { - error = sysc_get_one_clock(ddata, ddata->clock_roles[i]); + for (i = 0; i < SYSC_MAX_CLOCKS; i++) { + const char *name = ddata->clock_roles[i]; + + if (!name) + continue; + + error = sysc_get_one_clock(ddata, name); if (error && error != -ENOENT) return error; } |