clk: meson: gxbb: protect against holes in the onecell_data array
authorJerome Brunet <jbrunet@baylibre.com>
Tue, 28 Mar 2017 08:47:22 +0000 (10:47 +0200)
committerJerome Brunet <jbrunet@baylibre.com>
Fri, 7 Apr 2017 14:50:44 +0000 (16:50 +0200)
The clock controller is getting more complex and it might be possible, in
the future, to have holes in the clk_hw_onecell_data array. Just make sure
we skip those holes if it ever happens.

Acked-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
drivers/clk/meson/gxbb.c

index 75197664a7ee87b214ec7b9f4b4b815b5546f677..28812ea41a6093ae9a55df39bda4a8c8a7b8f621 100644 (file)
@@ -1388,6 +1388,10 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
         * register all clks
         */
        for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) {
+               /* array might be sparse */
+               if (!clkc_data->hw_onecell_data->hws[clkid])
+                       continue;
+
                ret = devm_clk_hw_register(dev,
                                        clkc_data->hw_onecell_data->hws[clkid]);
                if (ret)