100-00-clk-remove-log_ret-from-clk_get_rate.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 19f2aa053d5531a9ca0ece04dca172a522d58b90 Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Fri, 29 Jul 2022 11:32:28 +0800
  4. Subject: [PATCH 32/71] clk: remove log_ret from clk_get_rate
  5. The return value of clk_get_rate is ulong, an unsigned type. The size of
  6. ulong depends on the cpu architecture, i.e. 4 bytes on 32-bit CPUs and
  7. 8 bytes on 64-bit CPUs.
  8. However log_ret only accepts and returns value in int type, a fixed 4-byte
  9. type. This may truncate the real clock value and cause unexpected error on
  10. 64-bit platforms.
  11. This patch removes log_ret to solve this issue.
  12. Signed-off-by: Weijie Gao <[email protected]>
  13. ---
  14. drivers/clk/clk-uclass.c | 7 +------
  15. 1 file changed, 1 insertion(+), 6 deletions(-)
  16. --- a/drivers/clk/clk-uclass.c
  17. +++ b/drivers/clk/clk-uclass.c
  18. @@ -471,7 +471,6 @@ void clk_free(struct clk *clk)
  19. ulong clk_get_rate(struct clk *clk)
  20. {
  21. const struct clk_ops *ops;
  22. - int ret;
  23. debug("%s(clk=%p)\n", __func__, clk);
  24. if (!clk_valid(clk))
  25. @@ -481,11 +480,7 @@ ulong clk_get_rate(struct clk *clk)
  26. if (!ops->get_rate)
  27. return -ENOSYS;
  28. - ret = ops->get_rate(clk);
  29. - if (ret)
  30. - return log_ret(ret);
  31. -
  32. - return 0;
  33. + return ops->get_rate(clk);
  34. }
  35. struct clk *clk_get_parent(struct clk *clk)