diff options
author | Tony Lindgren <tony@atomide.com> | 2019-03-21 14:00:21 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2019-04-01 10:38:37 -0400 |
commit | aaa29bb01cc4bf5a87dbdb219efba3b09f259d8e (patch) | |
tree | 6c272500ee112dfc565e8132ac6d4b5a066e1a91 | |
parent | 8b30919a4e3c7aba32dd72e8208147a6496cb16c (diff) |
bus: ti-sysc: Fix sysc_unprepare() when no clocks have been allocated
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>
-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 d299ec79e4c3..647caccacee6 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c | |||
@@ -1331,6 +1331,9 @@ static void sysc_unprepare(struct sysc *ddata) | |||
1331 | { | 1331 | { |
1332 | int i; | 1332 | int i; |
1333 | 1333 | ||
1334 | if (!ddata->clocks) | ||
1335 | return; | ||
1336 | |||
1334 | for (i = 0; i < SYSC_MAX_CLOCKS; i++) { | 1337 | for (i = 0; i < SYSC_MAX_CLOCKS; i++) { |
1335 | if (!IS_ERR_OR_NULL(ddata->clocks[i])) | 1338 | if (!IS_ERR_OR_NULL(ddata->clocks[i])) |
1336 | clk_unprepare(ddata->clocks[i]); | 1339 | clk_unprepare(ddata->clocks[i]); |