Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: "Adrian Barnaś" <abarnas@google.com>
Cc: Tero Kristo <kristo@kernel.org>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-clk@vger.kernel.org>
Subject: Re: [PATCH] clk: keystone: Fix discarded const qualifiers
Date: Wed, 12 Nov 2025 09:09:47 -0600	[thread overview]
Message-ID: <20251112150947.i6iionea3cqrpkxe@pacemaker> (raw)
In-Reply-To: <20251028161643.1727046-1-abarnas@google.com>

On 16:16-20251028, Adrian Barnaś wrote:
> Add const qualifiers to the pointers returned from 'container_of' macro
> to prevent breaking the const promise on const struct pointers from
> parameters.
> 
> Once you have a mutable container structure pointer, you can change
> structure fields through it, which violates the const guarantee.
> 
> Signed-off-by: Adrian Barnaś <abarnas@google.com>
> ---
>  drivers/clk/keystone/sci-clk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
> index a4b42811de55..9d5071223f4c 100644
> --- a/drivers/clk/keystone/sci-clk.c
> +++ b/drivers/clk/keystone/sci-clk.c
> @@ -496,8 +496,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
>  static int _cmp_sci_clk_list(void *priv, const struct list_head *a,
>  			     const struct list_head *b)
>  {
> -	struct sci_clk *ca = container_of(a, struct sci_clk, node);
> -	struct sci_clk *cb = container_of(b, struct sci_clk, node);
> +	const struct sci_clk *ca = container_of(a, struct sci_clk, node);
> +	const struct sci_clk *cb = container_of(b, struct sci_clk, node);
>  
>  	return _cmp_sci_clk(ca, &cb);
>  }
> -- 
> 2.51.1.851.g4ebd6896fd-goog
> 
> 
Reviewed-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource


  reply	other threads:[~2025-11-12 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 16:16 [PATCH] clk: keystone: Fix discarded const qualifiers Adrian Barnaś
2025-11-12 15:09 ` Nishanth Menon [this message]
2025-11-14  2:18 ` Stephen Boyd

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=20251112150947.i6iionea3cqrpkxe@pacemaker \
    --to=nm@ti.com \
    --cc=abarnas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kristo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=ssantosh@kernel.org \
    /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