diff options
author | Mathias Kresin <dev@kresin.me> | 2017-07-28 19:38:04 +0200 |
---|---|---|
committer | Mathias Kresin <dev@kresin.me> | 2017-07-29 09:24:23 +0200 |
commit | 0a17d2970a5ea9dd83b0fc194cccb38dca19d29b (patch) | |
tree | 0cef8451db4155d2b91d5e8c9356731a1e98c586 /target/linux/ramips | |
parent | ea751c972b1f1f7f85a8dedda7dbccce31a58fd5 (diff) | |
download | mtk-20170518-0a17d2970a5ea9dd83b0fc194cccb38dca19d29b.zip mtk-20170518-0a17d2970a5ea9dd83b0fc194cccb38dca19d29b.tar.gz mtk-20170518-0a17d2970a5ea9dd83b0fc194cccb38dca19d29b.tar.bz2 |
ramips: add NULL clock fix send upstream
Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.
Fixes: FS#735
Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target/linux/ramips')
-rw-r--r-- | target/linux/ramips/patches-4.9/0101-MIPS-ralink-allow-NULL-clock-for-clk_get_rate.patch | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-4.9/0101-MIPS-ralink-allow-NULL-clock-for-clk_get_rate.patch b/target/linux/ramips/patches-4.9/0101-MIPS-ralink-allow-NULL-clock-for-clk_get_rate.patch new file mode 100644 index 0000000..998b0e4 --- /dev/null +++ b/target/linux/ramips/patches-4.9/0101-MIPS-ralink-allow-NULL-clock-for-clk_get_rate.patch @@ -0,0 +1,43 @@ +From patchwork Tue Jul 18 10:17:29 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [8/9] MIPS: ralink: allow NULL clock for clk_get_rate +X-Patchwork-Submitter: Jonas Gorski <jonas.gorski@gmail.com> +X-Patchwork-Id: 16778 +Message-Id: <20170718101730.2541-9-jonas.gorski@gmail.com> +To: unlisted-recipients:; (no To-header on input) +Cc: John Crispin <john@phrozen.org>, + Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org, + linux-kernel@vger.kernel.org +Date: Tue, 18 Jul 2017 12:17:29 +0200 +From: Jonas Gorski <jonas.gorski@gmail.com> +List-Id: linux-mips <linux-mips.eddie.linux-mips.org> + +Make the behaviour of clk_get_rate consistent with common clk's +clk_get_rate by accepting NULL clocks as parameter. Some device +drivers rely on this, and will cause an OOPS otherwise. + +Fixes: 3f0a06b0368d ("MIPS: ralink: adds clkdev code") +Cc: John Crispin <john@phrozen.org> +Cc: Ralf Baechle <ralf@linux-mips.org> +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Reported-by: Mathias Kresin <dev@kresin.me> +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + arch/mips/ralink/clk.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/mips/ralink/clk.c ++++ b/arch/mips/ralink/clk.c +@@ -52,6 +52,9 @@ EXPORT_SYMBOL_GPL(clk_disable); + + unsigned long clk_get_rate(struct clk *clk) + { ++ if (!clk) ++ return 0; ++ + return clk->rate; + } + EXPORT_SYMBOL_GPL(clk_get_rate); |