From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Julien Masson <jmasson@baylibre.com>, u-boot@lists.denx.de
Cc: Sean Anderson <seanga2@gmail.com>, Lukasz Majewski <lukma@denx.de>
Subject: Re: [PATCH] clk: fix clk_get_rate() always return ulong
Date: Fri, 15 Dec 2023 13:34:12 +0100 [thread overview]
Message-ID: <878r5vtzjv.fsf@baylibre.com> (raw)
In-Reply-To: <871qcj5frz.fsf@baylibre.com>
Hi Julien,
Thank you for the patch.
On mar., nov. 21, 2023 at 15:42, Julien Masson <jmasson@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.
This is quite subtle, it only happens when log_reg is enabled via
CONFIG_LOG_ERROR_RETURN.
> Otherwise we may return an invalid/truncated clock rate value.
>
> Signed-off-by: Julien Masson <jmasson@baylibre.com>
I'm wondering if there are any other places where this happens,
but this change looks good to me.
Reviewed-by: Mattijs Korpershoek <mkorpershoek@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
next prev parent reply other threads:[~2023-12-15 12:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 14:42 [PATCH] clk: fix clk_get_rate() always return ulong Julien Masson
2023-12-15 12:34 ` Mattijs Korpershoek [this message]
2023-12-15 12:54 ` Mattijs Korpershoek
2023-12-15 13:49 ` Julien Masson
2023-12-15 13:34 ` Julien Masson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878r5vtzjv.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=jmasson@baylibre.com \
--cc=lukma@denx.de \
--cc=seanga2@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox