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 |
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
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 --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
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(-)