Linux clock framework development
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: kristo@kernel.org, mturquette@baylibre.com, nm@ti.com,
	ssantosh@kernel.org, sunran001@208suo.com
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: keystone: sci-clk: fix application of sizeof to pointer
Date: Tue, 22 Aug 2023 16:01:43 -0700	[thread overview]
Message-ID: <ff6a9b1567e0a36fd0a7ae628d2d92d4.sboyd@kernel.org> (raw)
In-Reply-To: <8cfd376d48d63670882b8079c411d605@208suo.com>

Quoting sunran001@208suo.com (2023-07-20 18:14:19)
> ./drivers/clk/keystone/sci-clk.c:390:8-14: ERROR: application of sizeof
> to pointer
> 
> Signed-off-by: Ran Sun <sunran001@208suo.com>
> ---
>   drivers/clk/keystone/sci-clk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/keystone/sci-clk.c 
> b/drivers/clk/keystone/sci-clk.c
> index 6c1df4f11536..2c68c1e09d1f 100644
> --- a/drivers/clk/keystone/sci-clk.c
> +++ b/drivers/clk/keystone/sci-clk.c
> @@ -389,7 +389,7 @@ static struct clk_hw *sci_clk_get(struct 
> of_phandle_args *clkspec, void *data)
>         key.clk_id = clkspec->args[1];
> 
>         clk = bsearch(&key, provider->clocks, provider->num_clocks,

Huh? I see 'provider->clocks' is struct sci_clk_provider::clocks which
is of type 'struct sci_clk **'. It looks like each element in the array
is a 'struct sci_clk *', so if we want to silence the coccinelle warning
perhaps this should change to sizeof(*clk). Certainly we don't want to
change it to be the sizeof(struct sci_clk) though. Does changing the
sizeof() to deref the pointer work to silence the error?

> -                     sizeof(clk), _cmp_sci_clk);
> +                     sizeof(**clk), _cmp_sci_clk);

  reply	other threads:[~2023-08-22 23:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230721011303.4303-1-xujianghui@cdjrlc.com>
2023-07-21  1:14 ` [PATCH] clk: keystone: sci-clk: fix application of sizeof to pointer sunran001
2023-08-22 23:01   ` Stephen Boyd [this message]
2026-05-08 15:23 Nishanth Menon
2026-05-08 16:59 ` Andrew Davis
2026-05-08 17:07   ` Nishanth Menon
2026-05-09 11:34 ` Stepan Ionichev
     [not found] <20230720074906.3373-1-xujianghui@cdjrlc.com>
2023-07-20  8:42 ` sunran001
2023-07-20 13:55   ` Nishanth Menon

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=ff6a9b1567e0a36fd0a7ae628d2d92d4.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=kristo@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=nm@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=sunran001@208suo.com \
    /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