Skip to contentSkip to conversation

d80211: use BUILD_BUG_ON

PATCH New Johannes Berg 1 participant 1 message Aug 30, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 d80211: use BUILD_BUG_ON

This patch makes d80211 use BUILD_BUG_ON instead of checking at module initialisation time. This check really is only interesting while you hack since if the module was built, then it's either an 'always true' or 'always false' comparison, hence useless to do it at runtime.

net/d80211/ieee80211.c +2 -7
@@ -4833,13 +4833,8 @@ static int __init ieee80211_init(void)
 	struct sk_buff *skb;
 	int ret;
 
-	if (sizeof(struct ieee80211_tx_packet_data) > (sizeof(skb->cb))) {
-		printk("80211: ieee80211_tx_packet_data is bigger "
-		       "than the skb->cb (%d > %d)\n",
-		       (int) sizeof(struct ieee80211_tx_packet_data),
-		       (int) sizeof(skb->cb));
-		return -EINVAL;
-	}
+	BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
+
 	if ((ret = ieee80211_sysfs_init())) {
 		printk(KERN_WARNING "ieee80211_init: sysfs initialization "
 		       "failed\n");