aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-04-02 07:52:48 -0400
committerAdrian Bunk <bunk@stusta.de>2006-04-02 07:52:48 -0400
commit5d9428de1a9785f10a4339f80b717be665ba51c7 (patch)
tree27eeed8a87ef248cec694032463f0d8f3b38fbcc /drivers
parent7e99e9b66336565f0088ea59d848ab187f9689c3 (diff)
BUG_ON() Conversion in drivers/net/
this changes if() BUG(); constructs to BUG_ON() which is cleaner, contains unlikely() and can better optimized away. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/8139cp.c12
-rw-r--r--drivers/net/arcnet/arcnet.c3
-rw-r--r--drivers/net/b44.c3
-rw-r--r--drivers/net/chelsio/sge.c3
-rw-r--r--drivers/net/e1000/e1000_main.c3
-rw-r--r--drivers/net/eql.c3
-rw-r--r--drivers/net/irda/sa1100_ir.c3
-rw-r--r--drivers/net/ne2k-pci.c4
-rw-r--r--drivers/net/ns83820.c3
-rw-r--r--drivers/net/starfire.c3
-rw-r--r--drivers/net/tg3.c15
-rw-r--r--drivers/net/tokenring/abyss.c3
-rw-r--r--drivers/net/tokenring/madgemc.c3
-rw-r--r--drivers/net/wireless/ipw2200.c9
-rw-r--r--drivers/net/yellowfin.c3
15 files changed, 24 insertions, 49 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index ce99845d8266..066e22b01a94 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -539,8 +539,7 @@ rx_status_loop:
539 unsigned buflen; 539 unsigned buflen;
540 540
541 skb = cp->rx_skb[rx_tail].skb; 541 skb = cp->rx_skb[rx_tail].skb;
542 if (!skb) 542 BUG_ON(!skb);
543 BUG();
544 543
545 desc = &cp->rx_ring[rx_tail]; 544 desc = &cp->rx_ring[rx_tail];
546 status = le32_to_cpu(desc->opts1); 545 status = le32_to_cpu(desc->opts1);
@@ -723,8 +722,7 @@ static void cp_tx (struct cp_private *cp)
723 break; 722 break;
724 723
725 skb = cp->tx_skb[tx_tail].skb; 724 skb = cp->tx_skb[tx_tail].skb;
726 if (!skb) 725 BUG_ON(!skb);
727 BUG();
728 726
729 pci_unmap_single(cp->pdev, cp->tx_skb[tx_tail].mapping, 727 pci_unmap_single(cp->pdev, cp->tx_skb[tx_tail].mapping,
730 cp->tx_skb[tx_tail].len, PCI_DMA_TODEVICE); 728 cp->tx_skb[tx_tail].len, PCI_DMA_TODEVICE);
@@ -1550,8 +1548,7 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1550 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort); 1548 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
1551 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun); 1549 tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
1552 tmp_stats[i++] = cp->cp_stats.rx_frags; 1550 tmp_stats[i++] = cp->cp_stats.rx_frags;
1553 if (i != CP_NUM_STATS) 1551 BUG_ON(i != CP_NUM_STATS);
1554 BUG();
1555 1552
1556 pci_free_consistent(cp->pdev, sizeof(*nic_stats), nic_stats, dma); 1553 pci_free_consistent(cp->pdev, sizeof(*nic_stats), nic_stats, dma);
1557} 1554}
@@ -1856,8 +1853,7 @@ static void cp_remove_one (struct pci_dev *pdev)
1856 struct net_device *dev = pci_get_drvdata(pdev); 1853 struct net_device *dev = pci_get_drvdata(pdev);
1857 struct cp_private *cp = netdev_priv(dev); 1854 struct cp_private *cp = netdev_priv(dev);
1858 1855
1859 if (!dev) 1856 BUG_ON(!dev);
1860 BUG();
1861 unregister_netdev(dev); 1857 unregister_netdev(dev);
1862 iounmap(cp->regs); 1858 iounmap(cp->regs);
1863 if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0); 1859 if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0);
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 64e2caf3083d..fabc0607b0f1 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -765,8 +765,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs)
765 BUGMSG(D_DURING, "in arcnet_interrupt\n"); 765 BUGMSG(D_DURING, "in arcnet_interrupt\n");
766 766
767 lp = dev->priv; 767 lp = dev->priv;
768 if (!lp) 768 BUG_ON(!lp);
769 BUG();
770 769
771 spin_lock(&lp->lock); 770 spin_lock(&lp->lock);
772 771
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 15032f2c7817..c4e12b5cbb92 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -608,8 +608,7 @@ static void b44_tx(struct b44 *bp)
608 struct ring_info *rp = &bp->tx_buffers[cons]; 608 struct ring_info *rp = &bp->tx_buffers[cons];
609 struct sk_buff *skb = rp->skb; 609 struct sk_buff *skb = rp->skb;
610 610
611 if (unlikely(skb == NULL)) 611 BUG_ON(skb == NULL);
612 BUG();
613 612
614 pci_unmap_single(bp->pdev, 613 pci_unmap_single(bp->pdev,
615 pci_unmap_addr(rp, mapping), 614 pci_unmap_addr(rp, mapping),
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 30ff8ea1a402..4391bf4bf573 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1093,8 +1093,7 @@ static int process_responses(struct adapter *adapter, int budget)
1093 if (likely(e->DataValid)) { 1093 if (likely(e->DataValid)) {
1094 struct freelQ *fl = &sge->freelQ[e->FreelistQid]; 1094 struct freelQ *fl = &sge->freelQ[e->FreelistQid];
1095 1095
1096 if (unlikely(!e->Sop || !e->Eop)) 1096 BUG_ON(!e->Sop || !e->Eop);
1097 BUG();
1098 if (unlikely(e->Offload)) 1097 if (unlikely(e->Offload))
1099 unexpected_offload(adapter, fl); 1098 unexpected_offload(adapter, fl);
1100 else 1099 else
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 49cd096a3c3d..add8dc4aa7b0 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3308,8 +3308,7 @@ e1000_clean(struct net_device *poll_dev, int *budget)
3308 3308
3309 while (poll_dev != &adapter->polling_netdev[i]) { 3309 while (poll_dev != &adapter->polling_netdev[i]) {
3310 i++; 3310 i++;
3311 if (unlikely(i == adapter->num_rx_queues)) 3311 BUG_ON(i == adapter->num_rx_queues);
3312 BUG();
3313 } 3312 }
3314 3313
3315 if (likely(adapter->num_tx_queues == 1)) { 3314 if (likely(adapter->num_tx_queues == 1)) {
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index aa1569182fd6..815436c6170f 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -203,8 +203,7 @@ static int eql_open(struct net_device *dev)
203 printk(KERN_INFO "%s: remember to turn off Van-Jacobson compression on " 203 printk(KERN_INFO "%s: remember to turn off Van-Jacobson compression on "
204 "your slave devices.\n", dev->name); 204 "your slave devices.\n", dev->name);
205 205
206 if (!list_empty(&eql->queue.all_slaves)) 206 BUG_ON(!list_empty(&eql->queue.all_slaves));
207 BUG();
208 207
209 eql->min_slaves = 1; 208 eql->min_slaves = 1;
210 eql->max_slaves = EQL_DEFAULT_MAX_SLAVES; /* 4 usually... */ 209 eql->max_slaves = EQL_DEFAULT_MAX_SLAVES; /* 4 usually... */
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 63d38fbbd04e..f530686bd09f 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -695,8 +695,7 @@ static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
695 /* 695 /*
696 * We must not be transmitting... 696 * We must not be transmitting...
697 */ 697 */
698 if (si->txskb) 698 BUG_ON(si->txskb);
699 BUG();
700 699
701 netif_stop_queue(dev); 700 netif_stop_queue(dev);
702 701
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index d11821dd86ed..ced9fdb8335c 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -645,9 +645,7 @@ static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev)
645{ 645{
646 struct net_device *dev = pci_get_drvdata(pdev); 646 struct net_device *dev = pci_get_drvdata(pdev);
647 647
648 if (!dev) 648 BUG_ON(!dev);
649 BUG();
650
651 unregister_netdev(dev); 649 unregister_netdev(dev);
652 release_region(dev->base_addr, NE_IO_EXTENT); 650 release_region(dev->base_addr, NE_IO_EXTENT);
653 free_netdev(dev); 651 free_netdev(dev);
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 8e9b1a537dee..706aed7d717f 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -568,8 +568,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb)
568#endif 568#endif
569 569
570 sg = dev->rx_info.descs + (next_empty * DESC_SIZE); 570 sg = dev->rx_info.descs + (next_empty * DESC_SIZE);
571 if (unlikely(NULL != dev->rx_info.skbs[next_empty])) 571 BUG_ON(NULL != dev->rx_info.skbs[next_empty]);
572 BUG();
573 dev->rx_info.skbs[next_empty] = skb; 572 dev->rx_info.skbs[next_empty] = skb;
574 573
575 dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC; 574 dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC;
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 35b18057fbdd..45ad036733e2 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -2122,8 +2122,7 @@ static void __devexit starfire_remove_one (struct pci_dev *pdev)
2122 struct net_device *dev = pci_get_drvdata(pdev); 2122 struct net_device *dev = pci_get_drvdata(pdev);
2123 struct netdev_private *np = netdev_priv(dev); 2123 struct netdev_private *np = netdev_priv(dev);
2124 2124
2125 if (!dev) 2125 BUG_ON(!dev);
2126 BUG();
2127 2126
2128 unregister_netdev(dev); 2127 unregister_netdev(dev);
2129 2128
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 964c09644832..46f55fb9a053 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2966,9 +2966,7 @@ static void tg3_tx(struct tg3 *tp)
2966 struct sk_buff *skb = ri->skb; 2966 struct sk_buff *skb = ri->skb;
2967 int i; 2967 int i;
2968 2968
2969 if (unlikely(skb == NULL)) 2969 BUG_ON(skb == NULL);
2970 BUG();
2971
2972 pci_unmap_single(tp->pdev, 2970 pci_unmap_single(tp->pdev,
2973 pci_unmap_addr(ri, mapping), 2971 pci_unmap_addr(ri, mapping),
2974 skb_headlen(skb), 2972 skb_headlen(skb),
@@ -2979,12 +2977,10 @@ static void tg3_tx(struct tg3 *tp)
2979 sw_idx = NEXT_TX(sw_idx); 2977 sw_idx = NEXT_TX(sw_idx);
2980 2978
2981 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 2979 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
2982 if (unlikely(sw_idx == hw_idx)) 2980 BUG_ON(sw_idx == hw_idx);
2983 BUG();
2984 2981
2985 ri = &tp->tx_buffers[sw_idx]; 2982 ri = &tp->tx_buffers[sw_idx];
2986 if (unlikely(ri->skb != NULL)) 2983 BUG_ON(ri->skb != NULL);
2987 BUG();
2988 2984
2989 pci_unmap_page(tp->pdev, 2985 pci_unmap_page(tp->pdev,
2990 pci_unmap_addr(ri, mapping), 2986 pci_unmap_addr(ri, mapping),
@@ -4935,9 +4931,8 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
4935{ 4931{
4936 int i; 4932 int i;
4937 4933
4938 if (offset == TX_CPU_BASE && 4934 BUG_ON(offset == TX_CPU_BASE &&
4939 (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) 4935 (tp->tg3_flags2 & TG3_FLG2_5705_PLUS));
4940 BUG();
4941 4936
4942 if (offset == RX_CPU_BASE) { 4937 if (offset == RX_CPU_BASE) {
4943 for (i = 0; i < 10000; i++) { 4938 for (i = 0; i < 10000; i++) {
diff --git a/drivers/net/tokenring/abyss.c b/drivers/net/tokenring/abyss.c
index 9345e68c451e..649d8ea354f5 100644
--- a/drivers/net/tokenring/abyss.c
+++ b/drivers/net/tokenring/abyss.c
@@ -438,8 +438,7 @@ static void __devexit abyss_detach (struct pci_dev *pdev)
438{ 438{
439 struct net_device *dev = pci_get_drvdata(pdev); 439 struct net_device *dev = pci_get_drvdata(pdev);
440 440
441 if (!dev) 441 BUG_ON(!dev);
442 BUG();
443 unregister_netdev(dev); 442 unregister_netdev(dev);
444 release_region(dev->base_addr-0x10, ABYSS_IO_EXTENT); 443 release_region(dev->base_addr-0x10, ABYSS_IO_EXTENT);
445 free_irq(dev->irq, dev); 444 free_irq(dev->irq, dev);
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c
index 3a25d191ea4a..19e6f4dfd69c 100644
--- a/drivers/net/tokenring/madgemc.c
+++ b/drivers/net/tokenring/madgemc.c
@@ -735,8 +735,7 @@ static int __devexit madgemc_remove(struct device *device)
735 struct net_local *tp; 735 struct net_local *tp;
736 struct card_info *card; 736 struct card_info *card;
737 737
738 if (!dev) 738 BUG_ON(!dev);
739 BUG();
740 739
741 tp = dev->priv; 740 tp = dev->priv;
742 card = tp->tmspriv; 741 card = tp->tmspriv;
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 9dce522526c5..bca89cff85a6 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -5573,8 +5573,7 @@ static void ipw_adhoc_create(struct ipw_priv *priv,
5573 case IEEE80211_52GHZ_BAND: 5573 case IEEE80211_52GHZ_BAND:
5574 network->mode = IEEE_A; 5574 network->mode = IEEE_A;
5575 i = ieee80211_channel_to_index(priv->ieee, priv->channel); 5575 i = ieee80211_channel_to_index(priv->ieee, priv->channel);
5576 if (i == -1) 5576 BUG_ON(i == -1);
5577 BUG();
5578 if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { 5577 if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) {
5579 IPW_WARNING("Overriding invalid channel\n"); 5578 IPW_WARNING("Overriding invalid channel\n");
5580 priv->channel = geo->a[0].channel; 5579 priv->channel = geo->a[0].channel;
@@ -5587,8 +5586,7 @@ static void ipw_adhoc_create(struct ipw_priv *priv,
5587 else 5586 else
5588 network->mode = IEEE_B; 5587 network->mode = IEEE_B;
5589 i = ieee80211_channel_to_index(priv->ieee, priv->channel); 5588 i = ieee80211_channel_to_index(priv->ieee, priv->channel);
5590 if (i == -1) 5589 BUG_ON(i == -1);
5591 BUG();
5592 if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) { 5590 if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) {
5593 IPW_WARNING("Overriding invalid channel\n"); 5591 IPW_WARNING("Overriding invalid channel\n");
5594 priv->channel = geo->bg[0].channel; 5592 priv->channel = geo->bg[0].channel;
@@ -6715,8 +6713,7 @@ static int ipw_qos_association(struct ipw_priv *priv,
6715 6713
6716 switch (priv->ieee->iw_mode) { 6714 switch (priv->ieee->iw_mode) {
6717 case IW_MODE_ADHOC: 6715 case IW_MODE_ADHOC:
6718 if (!(network->capability & WLAN_CAPABILITY_IBSS)) 6716 BUG_ON(!(network->capability & WLAN_CAPABILITY_IBSS));
6719 BUG();
6720 6717
6721 qos_data = &ibss_data; 6718 qos_data = &ibss_data;
6722 break; 6719 break;
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 75d56bfef0ee..fd0f43b7db5b 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -1441,8 +1441,7 @@ static void __devexit yellowfin_remove_one (struct pci_dev *pdev)
1441 struct net_device *dev = pci_get_drvdata(pdev); 1441 struct net_device *dev = pci_get_drvdata(pdev);
1442 struct yellowfin_private *np; 1442 struct yellowfin_private *np;
1443 1443
1444 if (!dev) 1444 BUG_ON(!dev);
1445 BUG();
1446 np = netdev_priv(dev); 1445 np = netdev_priv(dev);
1447 1446
1448 pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status, 1447 pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status,