* [PATCH] clk: keystone: Fix discarded const qualifiers
@ 2025-10-28 16:16 Adrian Barnaś
2025-11-12 15:09 ` Nishanth Menon
2025-11-14 2:18 ` Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Adrian Barnaś @ 2025-10-28 16:16 UTC (permalink / raw)
To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Michael Turquette,
Stephen Boyd
Cc: Greg Kroah-Hartman, Adrian Barnaś, linux-arm-kernel,
linux-kernel, linux-clk
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: keystone: Fix discarded const qualifiers
2025-10-28 16:16 [PATCH] clk: keystone: Fix discarded const qualifiers Adrian Barnaś
@ 2025-11-12 15:09 ` Nishanth Menon
2025-11-14 2:18 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Nishanth Menon @ 2025-11-12 15:09 UTC (permalink / raw)
To: Adrian Barnaś
Cc: Tero Kristo, Santosh Shilimkar, Michael Turquette, Stephen Boyd,
Greg Kroah-Hartman, linux-arm-kernel, linux-kernel, linux-clk
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: keystone: Fix discarded const qualifiers
2025-10-28 16:16 [PATCH] clk: keystone: Fix discarded const qualifiers Adrian Barnaś
2025-11-12 15:09 ` Nishanth Menon
@ 2025-11-14 2:18 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2025-11-14 2:18 UTC (permalink / raw)
To: Adrian Barnaś, Michael Turquette, Nishanth Menon,
Santosh Shilimkar, Tero Kristo
Cc: Greg Kroah-Hartman, Adrian Barnaś, linux-arm-kernel,
linux-kernel, linux-clk
Quoting Adrian Barnaś (2025-10-28 09:16:42)
> 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>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-14 3:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 16:16 [PATCH] clk: keystone: Fix discarded const qualifiers Adrian Barnaś
2025-11-12 15:09 ` Nishanth Menon
2025-11-14 2:18 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox