Thread (3 messages) 3 messages, 3 authors, 2025-11-14
STALE243d

[PATCH] clk: keystone: Fix discarded const qualifiers

From: Adrian Barnaś <hidden>
Date: 2025-10-28 16:16:51
Also in: linux-clk, lkml
Subsystem: arm/texas instrument keystone clock framework, common clk framework, texas instruments' system control interface (tisci) protocol driver, the rest · Maintainers: Santosh Shilimkar, Michael Turquette, Stephen Boyd, Nishanth Menon, Tero Kristo, Linus Torvalds

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ś <redacted>
---
 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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help