111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. Make the behaviour of clk_get_rate consistent with common clk's
  19. clk_get_rate by accepting NULL clocks as parameter. Some device
  20. drivers rely on this, and will cause an OOPS otherwise.
  21. Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
  22. Cc: Ralf Baechle <ralf@linux-mips.org>
  23. Cc: Florian Fainelli <f.fainelli@gmail.com>
  24. Cc: bcm-kernel-feedback-list@broadcom.com
  25. Cc: James Hogan <james.hogan@imgtec.com>
  26. Cc: linux-mips@linux-mips.org
  27. Cc: linux-kernel@vger.kernel.org
  28. Reported-by: Mathias Kresin <dev@kresin.me>
  29. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  30. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
  31. ---
  32. arch/mips/bcm63xx/clk.c | 3 +++
  33. 1 file changed, 3 insertions(+)
  34. --- a/arch/mips/bcm63xx/clk.c
  35. +++ b/arch/mips/bcm63xx/clk.c
  36. @@ -345,6 +345,9 @@ EXPORT_SYMBOL(clk_disable);
  37. unsigned long clk_get_rate(struct clk *clk)
  38. {
  39. + if (!clk)
  40. + return 0;
  41. +
  42. return clk->rate;
  43. }