Commit aaa29bb0 authored by Tony Lindgren's avatar Tony Lindgren

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: 0eecc636 ("bus: ti-sysc: Add minimal TI sysc interconnect target driver")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 8b30919a
...@@ -1331,6 +1331,9 @@ static void sysc_unprepare(struct sysc *ddata) ...@@ -1331,6 +1331,9 @@ static void sysc_unprepare(struct sysc *ddata)
{ {
int i; int i;
if (!ddata->clocks)
return;
for (i = 0; i < SYSC_MAX_CLOCKS; i++) { for (i = 0; i < SYSC_MAX_CLOCKS; i++) {
if (!IS_ERR_OR_NULL(ddata->clocks[i])) if (!IS_ERR_OR_NULL(ddata->clocks[i]))
clk_unprepare(ddata->clocks[i]); clk_unprepare(ddata->clocks[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment