diff mbox series

locking/lockdep: Remove unnecessary DEBUG_LOCKS_WARN_ON()

Message ID 1559217575-30298-1-git-send-email-kobe-cp.wu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series locking/lockdep: Remove unnecessary DEBUG_LOCKS_WARN_ON() | expand

Commit Message

Kobe-CP Wu May 30, 2019, 11:59 a.m. UTC
DEBUG_LOCKS_WARN_ON() will turn off debug_locks and 
makes print_unlock_imbalance_bug() return directly.

Remove a redundant whitespace.

Signed-off-by: Kobe Wu <kobe-cp.wu@mediatek.com>
---
 kernel/locking/lockdep.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Will Deacon June 5, 2019, 12:46 p.m. UTC | #1
On Thu, May 30, 2019 at 07:59:35PM +0800, Kobe Wu wrote:
> DEBUG_LOCKS_WARN_ON() will turn off debug_locks and 
> makes print_unlock_imbalance_bug() return directly.
> 
> Remove a redundant whitespace.
> 
> Signed-off-by: Kobe Wu <kobe-cp.wu@mediatek.com>
> ---
>  kernel/locking/lockdep.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index d06190f..37c0a5e 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -4049,8 +4049,8 @@ static int __lock_downgrade(struct lockdep_map *lock, unsigned long ip)
>  	 * So we're all set to release this lock.. wait what lock? We don't
>  	 * own any locks, you've been drinking again?
>  	 */
> -	if (DEBUG_LOCKS_WARN_ON(depth <= 0))
> -		 return print_unlock_imbalance_bug(curr, lock, ip);
> +	if (depth <= 0)
> +		return print_unlock_imbalance_bug(curr, lock, ip);

Hmm, feels more like we should keep the DEBUG_LOCKS_WARN_ON but just
return 0 when it fires.

Peter?

Will
Peter Zijlstra June 5, 2019, 1:35 p.m. UTC | #2
On Wed, Jun 05, 2019 at 01:46:33PM +0100, Will Deacon wrote:
> On Thu, May 30, 2019 at 07:59:35PM +0800, Kobe Wu wrote:
> > DEBUG_LOCKS_WARN_ON() will turn off debug_locks and 
> > makes print_unlock_imbalance_bug() return directly.
> > 
> > Remove a redundant whitespace.
> > 
> > Signed-off-by: Kobe Wu <kobe-cp.wu@mediatek.com>
> > ---
> >  kernel/locking/lockdep.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> > index d06190f..37c0a5e 100644
> > --- a/kernel/locking/lockdep.c
> > +++ b/kernel/locking/lockdep.c
> > @@ -4049,8 +4049,8 @@ static int __lock_downgrade(struct lockdep_map *lock, unsigned long ip)
> >  	 * So we're all set to release this lock.. wait what lock? We don't
> >  	 * own any locks, you've been drinking again?
> >  	 */
> > -	if (DEBUG_LOCKS_WARN_ON(depth <= 0))
> > -		 return print_unlock_imbalance_bug(curr, lock, ip);
> > +	if (depth <= 0)
> > +		return print_unlock_imbalance_bug(curr, lock, ip);
> 
> Hmm, feels more like we should keep the DEBUG_LOCKS_WARN_ON but just
> return 0 when it fires.
> 
> Peter?

Nah, we should definitely print something when we try and release a lock
while not holding any. I think I'll take this one as is.
diff mbox series

Patch

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index d06190f..37c0a5e 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4049,8 +4049,8 @@  static int __lock_downgrade(struct lockdep_map *lock, unsigned long ip)
 	 * So we're all set to release this lock.. wait what lock? We don't
 	 * own any locks, you've been drinking again?
 	 */
-	if (DEBUG_LOCKS_WARN_ON(depth <= 0))
-		 return print_unlock_imbalance_bug(curr, lock, ip);
+	if (depth <= 0)
+		return print_unlock_imbalance_bug(curr, lock, ip);
 
 	/*
 	 * Check whether the lock exists in the current stack