Skip to contentSkip to conversation

hwspinlock: fix warning from sparse

PATCH In review Antonio Borneo 1 participant 2 messages Mar 23 – Mar 25 Hardware spinlock core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwspinlock: fix warning from sparse

Sparse triggers the following warnings:

drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in assignment (different address spaces)
drivers/hwspinlock/hwspinlock_core.c:392:9: expected void **slot
drivers/hwspinlock/hwspinlock_core.c:392:9: got void [noderef] __rcu **
drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in assignment (different address spaces)
drivers/hwspinlock/hwspinlock_core.c:392:9: expected void **slot
drivers/hwspinlock/hwspinlock_core.c:392:9: got void [noderef] __rcu **
drivers/hwspinlock/hwspinlock_core.c:393:48: warning: incorrect type in argument 1 (different address spaces)
drivers/hwspinlock/hwspinlock_core.c:393:48: expected void [noderef] __rcu **slot
drivers/hwspinlock/hwspinlock_core.c:393:48: got void **slot
drivers/hwspinlock/hwspinlock_core.c:397:30: warning: incorrect type in assignment (different address spaces)
drivers/hwspinlock/hwspinlock_core.c:397:30: expected void **slot
drivers/hwspinlock/hwspinlock_core.c:397:30: got void [noderef] __rcu **
drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in argument 1 (different address spaces)
drivers/hwspinlock/hwspinlock_core.c:392:9: expected void [noderef] __rcu **slot
drivers/hwspinlock/hwspinlock_core.c:392:9: got void **slot
drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in assignment (different address spaces)
drivers/hwspinlock/hwspinlock_core.c:392:9: expected void **slot
drivers/hwspinlock/hwspinlock_core.c:392:9: got void [noderef] __rcu **

all linked to the same missing '__rcu' at declaration of 'slot'.

Fix it!

---
 drivers/hwspinlock/hwspinlock_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwspinlock/hwspinlock_core.c +1 -1
index cc8e952a67727..50a875b2353f8 100644
@@ -372,7 +372,7 @@ int of_hwspin_lock_get_id(struct device_node *np, int index)
 	struct of_phandle_args args;
 	struct hwspinlock *hwlock;
 	struct radix_tree_iter iter;
-	void **slot;
+	void __rcu **slot;
 	int id;
 	int ret;
 

base-commit: c369299895a591d96745d6492d4888259b004a9e

Signature · 1 line
2.34.1
#1 lore raw
Quoted 35 lines · Antonio Borneo

Sparse triggers the following warnings:

drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in assignment (different address spaces) drivers/hwspinlock/hwspinlock_core.c:392:9:    expected void **slot drivers/hwspinlock/hwspinlock_core.c:392:9:    got void [noderef] __rcu ** drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in assignment (different address spaces) drivers/hwspinlock/hwspinlock_core.c:392:9:    expected void **slot drivers/hwspinlock/hwspinlock_core.c:392:9:    got void [noderef] __rcu ** drivers/hwspinlock/hwspinlock_core.c:393:48: warning: incorrect type in argument 1 (different address spaces) drivers/hwspinlock/hwspinlock_core.c:393:48:    expected void [noderef] __rcu **slot drivers/hwspinlock/hwspinlock_core.c:393:48:    got void **slot drivers/hwspinlock/hwspinlock_core.c:397:30: warning: incorrect type in assignment (different address spaces) drivers/hwspinlock/hwspinlock_core.c:397:30:    expected void **slot drivers/hwspinlock/hwspinlock_core.c:397:30:    got void [noderef] __rcu ** drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in argument 1 (different address spaces) drivers/hwspinlock/hwspinlock_core.c:392:9:    expected void [noderef] __rcu **slot drivers/hwspinlock/hwspinlock_core.c:392:9:    got void **slot drivers/hwspinlock/hwspinlock_core.c:392:9: warning: incorrect type in assignment (different address spaces) drivers/hwspinlock/hwspinlock_core.c:392:9:    expected void **slot drivers/hwspinlock/hwspinlock_core.c:392:9:    got void [noderef] __rcu **

all linked to the same missing '__rcu' at declaration of 'slot'.

Fix it!

---
 drivers/hwspinlock/hwspinlock_core.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwspinlock/hwspinlock_core.c +0 -0
index cc8e952a67727..50a875b2353f8 100644

drivers/hwspinlock/hwspinlock_core.c int of_hwspin_lock_get_id(struct device_node *np, int index) · line 375

Quoted 5 lines
drivers/hwspinlock/hwspinlock_core.c +1 -1
@@ -372,7 +372,7 @@ int of_hwspin_lock_get_id(struct device_node *np, int index)
         struct of_phandle_args args;
         struct hwspinlock *hwlock;
         struct radix_tree_iter iter;
-       void **slot;
+       void __rcu **slot;

Please ignore this patch.

While it fixes a minor warning from sparse, the analysis in
http://sashiko.dev/#/patchset/20260323102210.228551-1-antonio.borneo%40foss.st.com
highlights a race if provider is unbind, plus I see another race between provider and consumer on async probe.

I'm checking to fix such races, addressing at the same time the warning from sparse. Merging this patch now will only create unnecessary dependency for backporting in stable.

Regards,
Antonio