ramips: switch to linux 4.14
[openwrt/openwrt.git] / target / linux / ramips / patches-4.9 / 0101-MIPS-ralink-allow-NULL-clock-for-clk_get_rate.patch
1 From patchwork Tue Jul 18 10:17:29 2017
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [8/9] MIPS: ralink: allow NULL clock for clk_get_rate
6 X-Patchwork-Submitter: Jonas Gorski <jonas.gorski@gmail.com>
7 X-Patchwork-Id: 16778
8 Message-Id: <20170718101730.2541-9-jonas.gorski@gmail.com>
9 To: unlisted-recipients:; (no To-header on input)
10 Cc: John Crispin <john@phrozen.org>,
11 Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org,
12 linux-kernel@vger.kernel.org
13 Date: Tue, 18 Jul 2017 12:17:29 +0200
14 From: Jonas Gorski <jonas.gorski@gmail.com>
15 List-Id: linux-mips <linux-mips.eddie.linux-mips.org>
16
17 Make the behaviour of clk_get_rate consistent with common clk's
18 clk_get_rate by accepting NULL clocks as parameter. Some device
19 drivers rely on this, and will cause an OOPS otherwise.
20
21 Fixes: 3f0a06b0368d ("MIPS: ralink: adds clkdev code")
22 Cc: John Crispin <john@phrozen.org>
23 Cc: Ralf Baechle <ralf@linux-mips.org>
24 Cc: linux-mips@linux-mips.org
25 Cc: linux-kernel@vger.kernel.org
26 Reported-by: Mathias Kresin <dev@kresin.me>
27 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
28 ---
29 arch/mips/ralink/clk.c | 3 +++
30 1 file changed, 3 insertions(+)
31
32 --- a/arch/mips/ralink/clk.c
33 +++ b/arch/mips/ralink/clk.c
34 @@ -52,6 +52,9 @@ EXPORT_SYMBOL_GPL(clk_disable);
35
36 unsigned long clk_get_rate(struct clk *clk)
37 {
38 + if (!clk)
39 + return 0;
40 +
41 return clk->rate;
42 }
43 EXPORT_SYMBOL_GPL(clk_get_rate);