bus: ti-sysc: Fix optional clocks array access
authorTony Lindgren <tony@atomide.com>
Fri, 18 May 2018 14:54:44 +0000 (07:54 -0700)
committerTony Lindgren <tony@atomide.com>
Fri, 18 May 2018 14:54:44 +0000 (07:54 -0700)
We should be checking ddata->clocks[i] instead of clock_names[i]
for the optional clocks. Currently this just happens to work for
the typical case of one fck and one optional clock.

Fixes: 09dfe5810762 ("bus: ti-sysc: Add handling for clkctrl opt clocks")
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/bus/ti-sysc.c

index 9cd8cd8..1cc2962 100644 (file)
@@ -128,7 +128,7 @@ static int sysc_get_one_clock(struct sysc *ddata, const char *name)
 
        if (index < 0) {
                for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) {
-                       if (!clock_names[i]) {
+                       if (!ddata->clocks[i]) {
                                index = i;
                                break;
                        }