101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From patchwork Tue Jul 18 10:17:26 2017
  2. Content-Type: text/plain; charset="utf-8"
  3. MIME-Version: 1.0
  4. Content-Transfer-Encoding: 7bit
  5. Subject: [5/9] MIPS: AR7: allow NULL clock for clk_get_rate
  6. X-Patchwork-Submitter: Jonas Gorski <[email protected]>
  7. X-Patchwork-Id: 16775
  8. Message-Id: <[email protected]>
  9. To: unlisted-recipients:; (no To-header on input)
  10. Cc: Ralf Baechle <[email protected]>,
  11. Paul Gortmaker <[email protected]>,
  12. James Hogan <[email protected]>,
  13. [email protected], [email protected]
  14. Date: Tue, 18 Jul 2017 12:17:26 +0200
  15. From: Jonas Gorski <[email protected]>
  16. List-Id: linux-mips <linux-mips.eddie.linux-mips.org>
  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. Fixes: 780019ddf02f ("MIPS: AR7: Implement clock API")
  21. Cc: Ralf Baechle <[email protected]>
  22. Cc: Paul Gortmaker <[email protected]>
  23. Cc: James Hogan <[email protected]>
  24. Cc: [email protected]
  25. Cc: [email protected]
  26. Reported-by: Mathias Kresin <[email protected]>
  27. Signed-off-by: Jonas Gorski <[email protected]>
  28. ---
  29. arch/mips/ar7/clock.c | 3 +++
  30. 1 file changed, 3 insertions(+)
  31. --- a/arch/mips/ar7/clock.c
  32. +++ b/arch/mips/ar7/clock.c
  33. @@ -430,6 +430,9 @@ EXPORT_SYMBOL(clk_disable);
  34. unsigned long clk_get_rate(struct clk *clk)
  35. {
  36. + if (!clk)
  37. + return 0;
  38. +
  39. return clk->rate;
  40. }
  41. EXPORT_SYMBOL(clk_get_rate);