summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2019-03-21 11:00:21 -0700
committerTony Lindgren <tony@atomide.com>2019-04-01 07:38:37 -0700
commitaaa29bb01cc4bf5a87dbdb219efba3b09f259d8e (patch)
tree6c272500ee112dfc565e8132ac6d4b5a066e1a91 /drivers
parent8b30919a4e3c7aba32dd72e8208147a6496cb16c (diff)
downloadlinux-aaa29bb01cc4bf5a87dbdb219efba3b09f259d8e.tar.bz2
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bus/ti-sysc.c3
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)
{
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]);