[PATCH v2] clk: fix clk_get_rate() always return ulong
Sean Anderson
seanga2 at gmail.com
Fri Dec 15 17:30:41 CET 2023
On 12/15/23 09:09, Julien Masson 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.
Fixes: 5c5992cb90c ("clk: Add debugging for return values")
+CC Simon
> Signed-off-by: Julien Masson <jmasson at baylibre.com>
> ---
> Changes in v2:
> - remove local var ret (fix warning)
> - Link to v1: https://lore.kernel.org/all/871qcj5frz.fsf@baylibre.com
> ---
> drivers/clk/clk-uclass.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index 3b5e3f9c86..3cbcb2d033 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -478,7 +478,6 @@ void clk_free(struct clk *clk)
> ulong clk_get_rate(struct clk *clk)
> {
> const struct clk_ops *ops;
> - ulong ret;
>
> debug("%s(clk=%p)\n", __func__, clk);
> if (!clk_valid(clk))
> @@ -488,11 +487,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)
Anyway, I don't particularly care about logging the error here.
Reviewed-by: Sean Anderson <seanga2 at gmail.com>
More information about the U-Boot
mailing list