Commit d76944f8 authored by David Hildenbrand's avatar David Hildenbrand Committed by Michael S. Tsirkin
Browse files

virtio-mem: drop rc2 in virtio_mem_mb_plug_and_add()



We can drop rc2, we don't actually need the value.

Reviewed-by: default avatarPankaj Gupta <pankaj.gupta.linux@gmail.com>
Reviewed-by: default avatarWei Yang <richard.weiyang@linux.alibaba.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20201112133815.13332-5-david@redhat.com


Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 20b91502
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1070,7 +1070,7 @@ static int virtio_mem_mb_plug_and_add(struct virtio_mem *vm,
				      uint64_t *nb_sb)
{
	const int count = min_t(int, *nb_sb, vm->nb_sb_per_mb);
	int rc, rc2;
	int rc;

	if (WARN_ON_ONCE(!count))
		return -EINVAL;
@@ -1101,13 +1101,12 @@ static int virtio_mem_mb_plug_and_add(struct virtio_mem *vm,

		dev_err(&vm->vdev->dev,
			"adding memory block %lu failed with %d\n", mb_id, rc);
		rc2 = virtio_mem_mb_unplug_sb(vm, mb_id, 0, count);

		/*
		 * TODO: Linux MM does not properly clean up yet in all cases
		 * where adding of memory failed - especially on -ENOMEM.
		 */
		if (rc2)
		if (virtio_mem_mb_unplug_sb(vm, mb_id, 0, count))
			new_state = VIRTIO_MEM_MB_STATE_PLUGGED;
		virtio_mem_mb_set_state(vm, mb_id, new_state);
		return rc;