[PATCH] clk: fix clk_get_rate() always return ulong
Julien Masson
jmasson at baylibre.com
Fri Dec 15 14:34:59 CET 2023
Sorry for the noise but I miss a (obvious) warning:
drivers/clk/clk-uclass.c:474:8: warning: unused variable ‘ret’ [-Wunused-variable]
474 | ulong ret;
| ^~~
I will send a V2.
On Fri 15 Dec 2023 at 14:32, Julien Masson <jmasson at baylibre.com> wrote:
> When we call clk_get_rate(), we expect to get clock rate value as
> ulong.
> In that case we should not use log_ret() macro since it use internally
> an int.
> Otherwise we may return an invalid/truncated clock rate value.
>
> Signed-off-by: Julien Masson <jmasson at baylibre.com>
> ---
> drivers/clk/clk-uclass.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index 3b5e3f9c86..41dcd14be5 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -488,11 +488,7 @@ ulong clk_get_rate(struct clk *clk)
> if (!ops->get_rate)
> return -ENOSYS;
>
> - ret = ops->get_rate(clk);
> - if (ret)
> - return log_ret(ret);
> -
> - return 0;
> + return ops->get_rate(clk);
> }
>
> struct clk *clk_get_parent(struct clk *clk)
> --
> 2.41.0
>
--
Julien Masson
More information about the U-Boot
mailing list