lkml.org 
[lkml]   [2014]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sgi-xp: Do not use BUG_ON(!spin_is_locked())
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@mentor.com>
> ---
> 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


\
 
 \ /
  Last update: 2014-08-20 01:21    [W:0.065 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site