From: Herbert Xu Date: Thu, 16 May 2019 07:19:48 +0000 (+0800) Subject: rhashtable: Fix cmpxchg RCU warnings X-Git-Tag: v5.15~6297^2~27^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9458a4e337db565191e3f1cee71bb553802def4;p=platform%2Fkernel%2Flinux-starfive.git rhashtable: Fix cmpxchg RCU warnings As cmpxchg is a non-RCU mechanism it will cause sparse warnings when we use it for RCU. This patch adds explicit casts to silence those warnings. This should probably be moved to RCU itself in future. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 7708699..935ec80 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -131,7 +131,7 @@ static union nested_table *nested_table_alloc(struct rhashtable *ht, INIT_RHT_NULLS_HEAD(ntbl[i].bucket); } - if (cmpxchg(prev, NULL, ntbl) == NULL) + if (cmpxchg((union nested_table **)prev, NULL, ntbl) == NULL) return ntbl; /* Raced with another thread. */ kfree(ntbl); @@ -296,7 +296,8 @@ static int rhashtable_rehash_attach(struct rhashtable *ht, * rcu_assign_pointer(). */ - if (cmpxchg(&old_tbl->future_tbl, NULL, new_tbl) != NULL) + if (cmpxchg((struct bucket_table **)&old_tbl->future_tbl, NULL, + new_tbl) != NULL) return -EEXIST; return 0;