All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: Julien Masson <jmasson@baylibre.com>, u-boot@lists.denx.de
Cc: Lukasz Majewski <lukma@denx.de>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v2] clk: fix clk_get_rate() always return ulong
Date: Fri, 15 Dec 2023 11:30:41 -0500	[thread overview]
Message-ID: <f1618f28-e1fb-d4cd-3690-ec325818452c@gmail.com> (raw)
In-Reply-To: <87o7erv9p4.fsf@baylibre.com>


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@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@gmail.com>

  parent reply	other threads:[~2023-12-15 16:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 14:09 [PATCH v2] clk: fix clk_get_rate() always return ulong Julien Masson
2023-12-15 14:22 ` Mattijs Korpershoek
2023-12-15 16:30 ` Sean Anderson [this message]
2024-01-30  4:37 ` Sean Anderson

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=f1618f28-e1fb-d4cd-3690-ec325818452c@gmail.com \
    --to=seanga2@gmail.com \
    --cc=jmasson@baylibre.com \
    --cc=lukma@denx.de \
    --cc=mkorpershoek@baylibre.com \
    --cc=sjg@chromium.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.