diff options
author | Stefano Brivio <stefano.brivio@polimi.it> | 2008-02-08 00:31:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:37:06 -0500 |
commit | 4688be308f35f1e0099140a179d95c5e63b2319d (patch) | |
tree | 56212f2e95edd9d20fe5deadd9679b69552caa0a /drivers | |
parent | a297170dae2595f31b02e4553a3b217e115a15cf (diff) |
b43legacy: fix B43legacy_WARN_ON macro
Fix the B43legacy_WARN_ON macro so that it will evaluate expressions.
Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/b43legacy/b43legacy.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/b43legacy/main.c | 4 |
2 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index 17abf3cb2b1f..6a63a6e474f7 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -330,15 +330,7 @@ enum { | |||
330 | # undef assert | 330 | # undef assert |
331 | #endif | 331 | #endif |
332 | #ifdef CONFIG_B43LEGACY_DEBUG | 332 | #ifdef CONFIG_B43LEGACY_DEBUG |
333 | # define B43legacy_WARN_ON(expr) \ | 333 | # define B43legacy_WARN_ON(x) WARN_ON(x) |
334 | do { \ | ||
335 | if (unlikely((expr))) { \ | ||
336 | printk(KERN_INFO PFX "Test (%s) failed at:" \ | ||
337 | " %s:%d:%s()\n", \ | ||
338 | #expr, __FILE__, \ | ||
339 | __LINE__, __FUNCTION__); \ | ||
340 | } \ | ||
341 | } while (0) | ||
342 | # define B43legacy_BUG_ON(expr) \ | 334 | # define B43legacy_BUG_ON(expr) \ |
343 | do { \ | 335 | do { \ |
344 | if (unlikely((expr))) { \ | 336 | if (unlikely((expr))) { \ |
@@ -349,7 +341,9 @@ enum { | |||
349 | } while (0) | 341 | } while (0) |
350 | # define B43legacy_DEBUG 1 | 342 | # define B43legacy_DEBUG 1 |
351 | #else | 343 | #else |
352 | # define B43legacy_WARN_ON(x) do { /* nothing */ } while (0) | 344 | /* This will evaluate the argument even if debugging is disabled. */ |
345 | static inline bool __b43legacy_warn_on_dummy(bool x) { return x; } | ||
346 | # define B43_WARN_ON(x) __b43legacy_warn_on_dummy(unlikely(!!(x))) | ||
353 | # define B43legacy_BUG_ON(x) do { /* nothing */ } while (0) | 347 | # define B43legacy_BUG_ON(x) do { /* nothing */ } while (0) |
354 | # define B43legacy_DEBUG 0 | 348 | # define B43legacy_DEBUG 0 |
355 | #endif | 349 | #endif |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 62e679a1c05f..82953dd0bae0 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -1068,10 +1068,8 @@ static const u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev, | |||
1068 | B43legacy_WARN_ON(ie_start != offsetof(struct ieee80211_mgmt, | 1068 | B43legacy_WARN_ON(ie_start != offsetof(struct ieee80211_mgmt, |
1069 | u.beacon.variable)); | 1069 | u.beacon.variable)); |
1070 | 1070 | ||
1071 | if (src_size < ie_start) { | 1071 | if (B43legacy_WARN_ON(src_size < ie_start)) |
1072 | B43legacy_WARN_ON(1); | ||
1073 | return NULL; | 1072 | return NULL; |
1074 | } | ||
1075 | 1073 | ||
1076 | dest_data = kmalloc(src_size, GFP_ATOMIC); | 1074 | dest_data = kmalloc(src_size, GFP_ATOMIC); |
1077 | if (unlikely(!dest_data)) | 1075 | if (unlikely(!dest_data)) |