Commit 6a39bb15 authored by Colin Ian King's avatar Colin Ian King Committed by Michael S. Tsirkin
Browse files

virtio_vdpa: remove redundant check on desc



The boolean variable has_affinity is true when desc is non-null and
ops->set_vq_affinity is non-null. Hence the call to create_affinity_masks
does not need to check for desc being non-null is redundant when
has_affinity is true, so it can be removed as well as the now unused
default_affd.

Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
Message-Id: <20241107132114.22188-1-colin.i.king@gmail.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarEugenio Pérez <eperezma@redhat.com>
parent df28040c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -364,14 +364,13 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
	struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev);
	struct vdpa_device *vdpa = vd_get_vdpa(vdev);
	const struct vdpa_config_ops *ops = vdpa->config;
	struct irq_affinity default_affd = { 0 };
	struct cpumask *masks;
	struct vdpa_callback cb;
	bool has_affinity = desc && ops->set_vq_affinity;
	int i, err, queue_idx = 0;

	if (has_affinity) {
		masks = create_affinity_masks(nvqs, desc ? desc : &default_affd);
		masks = create_affinity_masks(nvqs, desc);
		if (!masks)
			return -ENOMEM;
	}