diff options
author | Jerome Brunet <jbrunet@baylibre.com> | 2018-01-19 16:55:21 +0100 |
---|---|---|
committer | Jerome Brunet <jbrunet@baylibre.com> | 2018-02-12 09:49:22 +0100 |
commit | 840e1a73ccbb2096d1286d72c18ccadd3956b0ae (patch) | |
tree | 8190cdafb15ce8202067de1b1c068c33d26d7b9f /drivers/clk/meson | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) | |
download | linux-stable-840e1a73ccbb2096d1286d72c18ccadd3956b0ae.tar.gz linux-stable-840e1a73ccbb2096d1286d72c18ccadd3956b0ae.tar.bz2 linux-stable-840e1a73ccbb2096d1286d72c18ccadd3956b0ae.zip |
clk: meson: check pll rate param table before using it
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>
Diffstat (limited to 'drivers/clk/meson')
-rw-r--r-- | drivers/clk/meson/clk-pll.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 01341553f50b..2614341fc4ad 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -94,6 +94,13 @@ static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, 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; @@ -109,6 +116,9 @@ static const struct pll_rate_table *meson_clk_get_pll_settings(struct meson_clk_ 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]; |