75a3a23a9ff3b103b37cf26b76e6edd464837f0b
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.4 / 111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch
1 From patchwork Tue Jul 18 10:17:27 2017
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [6/9] MIPS: BCM63XX: allow NULL clock for clk_get_rate
6 X-Patchwork-Submitter: Jonas Gorski <jonas.gorski@gmail.com>
7 X-Patchwork-Id: 16776
8 Message-Id: <20170718101730.2541-7-jonas.gorski@gmail.com>
9 To: unlisted-recipients:; (no To-header on input)
10 Cc: Ralf Baechle <ralf@linux-mips.org>,
11 Florian Fainelli <f.fainelli@gmail.com>,
12 bcm-kernel-feedback-list@broadcom.com,
13 James Hogan <james.hogan@imgtec.com>,
14 linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
15 Date: Tue, 18 Jul 2017 12:17:27 +0200
16 From: Jonas Gorski <jonas.gorski@gmail.com>
17 List-Id: linux-mips <linux-mips.eddie.linux-mips.org>
18
19 Make the behaviour of clk_get_rate consistent with common clk's
20 clk_get_rate by accepting NULL clocks as parameter. Some device
21 drivers rely on this, and will cause an OOPS otherwise.
22
23 Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
24 Cc: Ralf Baechle <ralf@linux-mips.org>
25 Cc: Florian Fainelli <f.fainelli@gmail.com>
26 Cc: bcm-kernel-feedback-list@broadcom.com
27 Cc: James Hogan <james.hogan@imgtec.com>
28 Cc: linux-mips@linux-mips.org
29 Cc: linux-kernel@vger.kernel.org
30 Reported-by: Mathias Kresin <dev@kresin.me>
31 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
32 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
33 ---
34 arch/mips/bcm63xx/clk.c | 3 +++
35 1 file changed, 3 insertions(+)
36
37 --- a/arch/mips/bcm63xx/clk.c
38 +++ b/arch/mips/bcm63xx/clk.c
39 @@ -345,6 +345,9 @@ EXPORT_SYMBOL(clk_disable);
40
41 unsigned long clk_get_rate(struct clk *clk)
42 {
43 + if (!clk)
44 + return 0;
45 +
46 return clk->rate;
47 }
48