Make sure the rate param table is available before using it.
Some read-only plls don't provide it, which is ok since the
table is not used by read-only clocks. R/W clocks are supposed
to provide it, but it does not hurt check it.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
const struct pll_rate_table *rate_table = pll->rate_table;
int i;
+ /*
+ * if the table is missing, just return the current rate
+ * since we don't have the other available frequencies
+ */
+ if (!rate_table)
+ return meson_clk_pll_recalc_rate(hw, *parent_rate);
+
for (i = 0; i < pll->rate_count; i++) {
if (rate <= rate_table[i].rate)
return rate_table[i].rate;
const struct pll_rate_table *rate_table = pll->rate_table;
int i;
+ if (!rate_table)
+ return NULL;
+
for (i = 0; i < pll->rate_count; i++) {
if (rate == rate_table[i].rate)
return &rate_table[i];