aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
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/net/virtio_net.c
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/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c12
1 files changed, 4 insertions, 8 deletions
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