On Wed, Apr 19, 2023 at 10:36:49AM -0400, William Breathitt Gray wrote: > The lock is acquired by rz_mtu3_lock_if_counter_is_valid(), so that > function needs a sparse __acquires(&priv->lock) annotation too. I found this bug using Smatch. It's a competing static checker which uses Sparse as a parser. I am the author of Smatch so I am naturally biased. I don't think it's as simple as that. I don't think Sparse has annotations for mutexes, only for spinlocks? Also it's really complicated to annotate something as taking the lock on the success path but not on the failure path. You have to set up a wrapper and use __cond_lock(). Every other feature in Sparse is awesome, but for locking, it's better to just use Smatch. regards, dan carpenter