Re: [PATCH v2 3/4] hwspinlock: annotate slot pointer as RCU sensitive

From: Andy Shevchenko

Date: Mon Jun 22 2026 - 06:26:09 EST


On Mon, Jun 22, 2026 at 10:52:02AM +0200, Wolfram Sang wrote:
> Because 'slot' is used within an RCU read-lock, it must not be accessed
> directly but with RCU helpers. Annotate the pointer to enforce checking
> this. Sparse confirms the missing annotation:

Very good!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> 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 **

^^^

No need to have dups per a couple of cases, though.

--
With Best Regards,
Andy Shevchenko