Re: [PATCH] sgi-xp: Do not use BUG_ON(!spin_is_locked())

From: Ryan Mallon
Date: Tue Aug 19 2014 - 19:04:31 EST


On 12/08/14 17:35, Sanjeev Sharma wrote:
> on some architecture spin_is_locked() always return false in
> uniprocessor configuration and can therefore not be used
> with BUG_ON.it would be advise to replace with
> lockdep_assert_held().
>
> Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@xxxxxxxxxx>
> ---
> drivers/misc/sgi-xp/xpc_channel.c | 6 +++---
> drivers/misc/sgi-xp/xpc_sn2.c | 2 +-
> drivers/misc/sgi-xp/xpc_uv.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
> index 128d561..240fe5a 100644
> --- a/drivers/misc/sgi-xp/xpc_channel.c
> +++ b/drivers/misc/sgi-xp/xpc_channel.c
> @@ -28,7 +28,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
> {
> enum xp_retval ret;
>
> - DBUG_ON(!spin_is_locked(&ch->lock));
> + lockdep_assert_held(!spin_is_locked(&ch->lock));

This is incorrect, and will break the build with CONFIG_LOCKDEP enabled.
You actually want:

lockdep_assert_held(&ch->lock);

Same for the other instances.

~Ryan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/