0100-MIPS-ralink-allow-NULL-clock-for-clk_get_rate.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. Make the behaviour of clk_get_rate consistent with common clk's
  17. clk_get_rate by accepting NULL clocks as parameter. Some device
  18. drivers rely on this, and will cause an OOPS otherwise.
  19. Fixes: 3f0a06b0368d ("MIPS: ralink: adds clkdev code")
  20. Cc: John Crispin <john@phrozen.org>
  21. Cc: Ralf Baechle <ralf@linux-mips.org>
  22. Cc: linux-mips@linux-mips.org
  23. Cc: linux-kernel@vger.kernel.org
  24. Reported-by: Mathias Kresin <dev@kresin.me>
  25. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  26. ---
  27. arch/mips/ralink/clk.c | 3 +++
  28. 1 file changed, 3 insertions(+)
  29. --- a/arch/mips/ralink/clk.c
  30. +++ b/arch/mips/ralink/clk.c
  31. @@ -52,6 +52,9 @@ EXPORT_SYMBOL_GPL(clk_disable);
  32. unsigned long clk_get_rate(struct clk *clk)
  33. {
  34. + if (!clk)
  35. + return 0;
  36. +
  37. return clk->rate;
  38. }
  39. EXPORT_SYMBOL_GPL(clk_get_rate);