Re: [PATCH] firmware: Do not use WARN_ON(!spin_is_locked())

Peter Zijlstra
2014-08-13T14:45:13Z

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

On Wed, Aug 13, 2014 at 03:18:36PM +0100, Matt Fleming wrote:
> On Sun, 10 Aug, at 08:54:13PM, Guenter Roeck wrote:
> > spin_is_locked() always returns false for uniprocessor configurations,
> > so do not use WARN_ON with it. WARN_ON_SMP() exists for that very
> > purpose and must be used instead.
>
>
> How about lockdep_assert_held()? That seems to be much more popular.

lockdep_assert_held() not only checks if the lock is taken, it also
verifies its taken by the current context, so its a stronger assertion.

And, as a bonus, it doesn't emit _any_ code on a !DEBUG build ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]