Skip to content

Commit fa3542e

Browse files
abarnas-usysbebarino
authored andcommitted
clk: keystone: Fix discarded const qualifiers
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>
1 parent 79d022d commit fa3542e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/clk/keystone/sci-clk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
496496
static int _cmp_sci_clk_list(void *priv, const struct list_head *a,
497497
const struct list_head *b)
498498
{
499-
struct sci_clk *ca = container_of(a, struct sci_clk, node);
500-
struct sci_clk *cb = container_of(b, struct sci_clk, node);
499+
const struct sci_clk *ca = container_of(a, struct sci_clk, node);
500+
const struct sci_clk *cb = container_of(b, struct sci_clk, node);
501501

502502
return _cmp_sci_clk(ca, &cb);
503503
}

0 commit comments

Comments
 (0)