aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Beregalov <a.beregalov@gmail.com>2009-04-11 10:50:23 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-13 18:44:36 -0400
commit0ee904c35cc3fdd26a9c76077d9692d458309186 (patch)
treece1dee044974b7c6040bbdb794747cd1baa8f6bb /drivers
parent710b523ac59426e8bfdea3533f42118e46b9cbfb (diff)
drivers/net: replace BUG() with BUG_ON() if possible
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/atl1e/atl1e_main.c3
-rw-r--r--drivers/net/atlx/atl1.c7
-rw-r--r--drivers/net/chelsio/sge.c4
-rw-r--r--drivers/net/fs_enet/mii-fec.c6
-rw-r--r--drivers/net/ixgb/ixgb_osdep.h2
-rw-r--r--drivers/net/pppol2tp.c3
-rw-r--r--drivers/net/tulip/winbond-840.c3
-rw-r--r--drivers/net/virtio_net.c12
-rw-r--r--drivers/net/wireless/ath5k/reset.c5
-rw-r--r--drivers/net/wireless/ath9k/ath9k.h6
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c7
-rw-r--r--drivers/net/wireless/libertas/if_usb.c3
-rw-r--r--drivers/net/wireless/libertas_tf/if_usb.c3
13 files changed, 22 insertions, 42 deletions
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index fb57b750866b..adac06195c8f 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -1794,8 +1794,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
1794 memcpy(use_tpd, tpd, sizeof(struct atl1e_tpd_desc)); 1794 memcpy(use_tpd, tpd, sizeof(struct atl1e_tpd_desc));
1795 1795
1796 tx_buffer = atl1e_get_tx_buffer(adapter, use_tpd); 1796 tx_buffer = atl1e_get_tx_buffer(adapter, use_tpd);
1797 if (tx_buffer->skb) 1797 BUG_ON(tx_buffer->skb);
1798 BUG();
1799 1798
1800 tx_buffer->skb = NULL; 1799 tx_buffer->skb = NULL;
1801 tx_buffer->length = 1800 tx_buffer->length =
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 0ab22540bf59..13f0bdc32449 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2207,8 +2207,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
2207 nr_frags = skb_shinfo(skb)->nr_frags; 2207 nr_frags = skb_shinfo(skb)->nr_frags;
2208 next_to_use = atomic_read(&tpd_ring->next_to_use); 2208 next_to_use = atomic_read(&tpd_ring->next_to_use);
2209 buffer_info = &tpd_ring->buffer_info[next_to_use]; 2209 buffer_info = &tpd_ring->buffer_info[next_to_use];
2210 if (unlikely(buffer_info->skb)) 2210 BUG_ON(buffer_info->skb);
2211 BUG();
2212 /* put skb in last TPD */ 2211 /* put skb in last TPD */
2213 buffer_info->skb = NULL; 2212 buffer_info->skb = NULL;
2214 2213
@@ -2274,8 +2273,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
2274 ATL1_MAX_TX_BUF_LEN; 2273 ATL1_MAX_TX_BUF_LEN;
2275 for (i = 0; i < nseg; i++) { 2274 for (i = 0; i < nseg; i++) {
2276 buffer_info = &tpd_ring->buffer_info[next_to_use]; 2275 buffer_info = &tpd_ring->buffer_info[next_to_use];
2277 if (unlikely(buffer_info->skb)) 2276 BUG_ON(buffer_info->skb);
2278 BUG(); 2277
2279 buffer_info->skb = NULL; 2278 buffer_info->skb = NULL;
2280 buffer_info->length = (buf_len > ATL1_MAX_TX_BUF_LEN) ? 2279 buffer_info->length = (buf_len > ATL1_MAX_TX_BUF_LEN) ?
2281 ATL1_MAX_TX_BUF_LEN : buf_len; 2280 ATL1_MAX_TX_BUF_LEN : buf_len;
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 58f6fc055f6a..5e97a1a71d88 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1149,8 +1149,8 @@ static inline void write_tx_desc(struct cmdQ_e *e, dma_addr_t mapping,
1149 unsigned int len, unsigned int gen, 1149 unsigned int len, unsigned int gen,
1150 unsigned int eop) 1150 unsigned int eop)
1151{ 1151{
1152 if (unlikely(len > SGE_TX_DESC_MAX_PLEN)) 1152 BUG_ON(len > SGE_TX_DESC_MAX_PLEN);
1153 BUG(); 1153
1154 e->addr_lo = (u32)mapping; 1154 e->addr_lo = (u32)mapping;
1155 e->addr_hi = (u64)mapping >> 32; 1155 e->addr_hi = (u64)mapping >> 32;
1156 e->len_gen = V_CMD_LEN(len) | V_CMD_GEN1(gen); 1156 e->len_gen = V_CMD_LEN(len) | V_CMD_GEN1(gen);
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 28077cc1b949..61aaae444b40 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -54,8 +54,7 @@ static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location)
54 fec_t __iomem *fecp = fec->fecp; 54 fec_t __iomem *fecp = fec->fecp;
55 int i, ret = -1; 55 int i, ret = -1;
56 56
57 if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) 57 BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0);
58 BUG();
59 58
60 /* Add PHY address to register command. */ 59 /* Add PHY address to register command. */
61 out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_read(location)); 60 out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_read(location));
@@ -79,8 +78,7 @@ static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location,
79 int i; 78 int i;
80 79
81 /* this must never happen */ 80 /* this must never happen */
82 if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) 81 BUG_ON((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0);
83 BUG();
84 82
85 /* Add PHY address to register command. */ 83 /* Add PHY address to register command. */
86 out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val)); 84 out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val));
diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
index d92e72bd627a..371a6be4d965 100644
--- a/drivers/net/ixgb/ixgb_osdep.h
+++ b/drivers/net/ixgb/ixgb_osdep.h
@@ -40,7 +40,7 @@
40#include <linux/sched.h> 40#include <linux/sched.h>
41 41
42#undef ASSERT 42#undef ASSERT
43#define ASSERT(x) if (!(x)) BUG() 43#define ASSERT(x) BUG_ON(!(x))
44#define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B) 44#define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B)
45 45
46#ifdef DBG 46#ifdef DBG
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 5b07dd8e5c04..5981debcde5e 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -1238,8 +1238,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)
1238 struct pppol2tp_session *session; 1238 struct pppol2tp_session *session;
1239 struct sock *sk; 1239 struct sock *sk;
1240 1240
1241 if (tunnel == NULL) 1241 BUG_ON(tunnel == NULL);
1242 BUG();
1243 1242
1244 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1243 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1245 "%s: closing all sessions...\n", tunnel->name); 1244 "%s: closing all sessions...\n", tunnel->name);
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 264e61404f34..842b1a2c40d4 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -1601,8 +1601,7 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state)
1601 1601
1602 /* no more hardware accesses behind this line. */ 1602 /* no more hardware accesses behind this line. */
1603 1603
1604 BUG_ON(np->csr6); 1604 BUG_ON(np->csr6 || ioread32(ioaddr + IntrEnable));
1605 if (ioread32(ioaddr + IntrEnable)) BUG();
1606 1605
1607 /* pci_power_off(pdev, -1); */ 1606 /* pci_power_off(pdev, -1); */
1608 1607
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9c82a39497e5..071855871524 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -621,12 +621,9 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
621 virtio_net_ctrl_ack status = ~0; 621 virtio_net_ctrl_ack status = ~0;
622 unsigned int tmp; 622 unsigned int tmp;
623 623
624 if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)) { 624 /* Caller should know better */
625 BUG(); /* Caller should know better */ 625 BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ||
626 return false; 626 (out + in > VIRTNET_SEND_COMMAND_SG_MAX));
627 }
628
629 BUG_ON(out + in > VIRTNET_SEND_COMMAND_SG_MAX);
630 627
631 out++; /* Add header */ 628 out++; /* Add header */
632 in++; /* Add return status */ 629 in++; /* Add return status */
@@ -640,8 +637,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
640 memcpy(&sg[1], data, sizeof(struct scatterlist) * (out + in - 2)); 637 memcpy(&sg[1], data, sizeof(struct scatterlist) * (out + in - 2));
641 sg_set_buf(&sg[out + in - 1], &status, sizeof(status)); 638 sg_set_buf(&sg[out + in - 1], &status, sizeof(status));
642 639
643 if (vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi) != 0) 640 BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi));
644 BUG();
645 641
646 vi->cvq->vq_ops->kick(vi->cvq); 642 vi->cvq->vq_ops->kick(vi->cvq);
647 643
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c
index 7a17d31b2fd9..cb5e15f97095 100644
--- a/drivers/net/wireless/ath5k/reset.c
+++ b/drivers/net/wireless/ath5k/reset.c
@@ -54,9 +54,8 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
54 u32 coef_scaled, coef_exp, coef_man, 54 u32 coef_scaled, coef_exp, coef_man,
55 ds_coef_exp, ds_coef_man, clock; 55 ds_coef_exp, ds_coef_man, clock;
56 56
57 if (!(ah->ah_version == AR5K_AR5212) || 57 BUG_ON(!(ah->ah_version == AR5K_AR5212) ||
58 !(channel->hw_value & CHANNEL_OFDM)) 58 !(channel->hw_value & CHANNEL_OFDM));
59 BUG();
60 59
61 /* Get coefficient 60 /* Get coefficient
62 * ALGO: coef = (5 * clock * carrier_freq) / 2) 61 * ALGO: coef = (5 * clock * carrier_freq) / 2)
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 2689a08a2844..7b1b40aaf09d 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -53,11 +53,7 @@ struct ath_node;
53 53
54#define A_MAX(a, b) ((a) > (b) ? (a) : (b)) 54#define A_MAX(a, b) ((a) > (b) ? (a) : (b))
55 55
56#define ASSERT(exp) do { \ 56#define ASSERT(exp) BUG_ON(!(exp))
57 if (unlikely(!(exp))) { \
58 BUG(); \
59 } \
60 } while (0)
61 57
62#define TSF_TO_TU(_h,_l) \ 58#define TSF_TO_TU(_h,_l) \
63 ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) 59 ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index bd4dbcfe1bbe..9a123fbcc359 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -3176,11 +3176,8 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3176 /* Start the Dma */ 3176 /* Start the Dma */
3177 rc = ipw_fw_dma_enable(priv); 3177 rc = ipw_fw_dma_enable(priv);
3178 3178
3179 if (priv->sram_desc.last_cb_index > 0) { 3179 /* the DMA is already ready this would be a bug. */
3180 /* the DMA is already ready this would be a bug. */ 3180 BUG_ON(priv->sram_desc.last_cb_index > 0);
3181 BUG();
3182 goto out;
3183 }
3184 3181
3185 do { 3182 do {
3186 chunk = (struct fw_chunk *)(data + offset); 3183 chunk = (struct fw_chunk *)(data + offset);
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index ea3dc038be76..d649caebf08a 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -686,8 +686,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
686 return; 686 return;
687 } 687 }
688 688
689 if (!in_interrupt()) 689 BUG_ON(!in_interrupt());
690 BUG();
691 690
692 spin_lock(&priv->driver_lock); 691 spin_lock(&priv->driver_lock);
693 692
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c
index 59634c33b1f9..392337b37b1d 100644
--- a/drivers/net/wireless/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/libertas_tf/if_usb.c
@@ -461,8 +461,7 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
461 return; 461 return;
462 } 462 }
463 463
464 if (!in_interrupt()) 464 BUG_ON(!in_interrupt());
465 BUG();
466 465
467 spin_lock(&priv->driver_lock); 466 spin_lock(&priv->driver_lock);
468 memcpy(priv->cmd_resp_buff, recvbuff + MESSAGE_HEADER_LEN, 467 memcpy(priv->cmd_resp_buff, recvbuff + MESSAGE_HEADER_LEN,