* + lockdep-make-lockdep_assert_held-not-have-a-return-value.patch added to -mm tree
@ 2013-01-23 21:23 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2013-01-23 21:23 UTC (permalink / raw)
To: mm-commits; +Cc: johannes.berg, mingo, peterz
The patch titled
Subject: lockdep: make lockdep_assert_held() not have a return value
has been added to the -mm tree. Its filename is
lockdep-make-lockdep_assert_held-not-have-a-return-value.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Johannes Berg <johannes.berg@intel.com>
Subject: lockdep: make lockdep_assert_held() not have a return value
I recently made the mistake of writing:
foo = lockdep_dereference_protected(..., lockdep_assert_held(...));
which is clearly bogus. If lockdep is disabled in the config this would
cause a compile failure, if it is enabled then it compiles and causes a
puzzling warning about dereferencing without the correct protection.
Wrap the macro in "do { ... } while (0)" to also fail compile for this
when lockdep is enabled.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/lockdep.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -puN include/linux/lockdep.h~lockdep-make-lockdep_assert_held-not-have-a-return-value include/linux/lockdep.h
--- a/include/linux/lockdep.h~lockdep-make-lockdep_assert_held-not-have-a-return-value
+++ a/include/linux/lockdep.h
@@ -359,7 +359,9 @@ extern void lockdep_trace_alloc(gfp_t ma
#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
-#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
+#define lockdep_assert_held(l) do { \
+ WARN_ON(debug_locks && !lockdep_is_held(l)); \
+ } while (0)
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
_
Patches currently in -mm which might be from johannes.berg@intel.com are
linux-next.patch
lockdep-make-lockdep_assert_held-not-have-a-return-value.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-01-23 21:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 21:23 + lockdep-make-lockdep_assert_held-not-have-a-return-value.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.