diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2019-05-16 15:19:48 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-16 09:45:20 -0700 |
commit | e9458a4e337db565191e3f1cee71bb553802def4 (patch) | |
tree | 35cbe33809ccfed6fbcd4ba1e844fed84b890e1f /lib/rhashtable.c | |
parent | ba6306e3f648a857ae52ddcabc2859542fd2f94c (diff) | |
download | lwn-e9458a4e337db565191e3f1cee71bb553802def4.tar.gz lwn-e9458a4e337db565191e3f1cee71bb553802def4.zip |
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 <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r-- | lib/rhashtable.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 7708699a5b96..935ec80f213f 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; |