diff options
author | Tony Lindgren <tony@atomide.com> | 2019-03-21 21:00:21 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-27 16:50:36 +0300 |
commit | 2fe6d9c113f52b8eda42dd65eeeac6ee424c765e (patch) | |
tree | 5a1b7e5ee14c4d7eed39ea748e1a06a9f2de3abd /drivers/bus | |
parent | 0d244fd367ce2616c641e8700131174cb802ae25 (diff) | |
download | linux-2fe6d9c113f52b8eda42dd65eeeac6ee424c765e.tar.xz |
bus: ti-sysc: Fix sysc_unprepare() when no clocks have been allocated
[ Upstream commit aaa29bb01cc4bf5a87dbdb219efba3b09f259d8e ]
If we return early before ddata->clocks have been allocated we will get a
NULL pointer dereference in sysc_unprepare(). Let's fix this by returning
early when no clocks are allocated.
Fixes: 0eecc636e5a2 ("bus: ti-sysc: Add minimal TI sysc interconnect target driver")
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 | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index 2813f9ed57c0..54c8c8644df2 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -1400,6 +1400,9 @@ static void sysc_unprepare(struct sysc *ddata) { int i; + if (!ddata->clocks) + return; + for (i = 0; i < SYSC_MAX_CLOCKS; i++) { if (!IS_ERR_OR_NULL(ddata->clocks[i])) clk_unprepare(ddata->clocks[i]); |