]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: keystone: Fix discarded const qualifiers
authorAdrian Barnaś <abarnas@google.com>
Tue, 28 Oct 2025 16:16:42 +0000 (16:16 +0000)
committerStephen Boyd <sboyd@kernel.org>
Fri, 14 Nov 2025 02:16:09 +0000 (18:16 -0800)
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>
Reviewed-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/keystone/sci-clk.c

index a4b42811de55deb822f76800ba68acbbdf27f4c5..9d5071223f4cb31bbca41694fde724757785514e 100644 (file)
@@ -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);
 }