Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74cf5b16 authored by Wei Wang's avatar Wei Wang Committed by Michael S. Tsirkin
Browse files

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: default avatarWei Wang <wei.w.wang@intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 94710cac
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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;