diff options
author | Wei Wang <wei.w.wang@intel.com> | 2018-08-16 15:50:56 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2018-08-22 00:56:24 +0300 |
commit | 74cf5b169c4c197a8c66feaf1a98bb009fa306f8 (patch) | |
tree | 5ca79bd27159873eef68d25b3ef215b8341b3561 /drivers/virtio | |
parent | 94710cac0ef4ee177a63b5227664b38c95bbf703 (diff) | |
download | linux-74cf5b169c4c197a8c66feaf1a98bb009fa306f8.tar.gz linux-74cf5b169c4c197a8c66feaf1a98bb009fa306f8.tar.bz2 linux-74cf5b169c4c197a8c66feaf1a98bb009fa306f8.zip |
virtio-balloon: remove BUG() in init_vqs
It's a bit overkill to use BUG when failing to add an entry to the
stats_vq in init_vqs. So remove it and just return the error to the
caller to bail out nicely.
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 3988c0914322..8100e77b1b0b 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -455,9 +455,13 @@ static int init_vqs(struct virtio_balloon *vb) num_stats = update_balloon_stats(vb); sg_init_one(&sg, vb->stats, sizeof(vb->stats[0]) * num_stats); - if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL) - < 0) - BUG(); + err = virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, + GFP_KERNEL); + if (err) { + dev_warn(&vb->vdev->dev, "%s: add stat_vq failed\n", + __func__); + return err; + } virtqueue_kick(vb->stats_vq); } return 0; |