> vring_create_virtqueue() and vring_create_virtqueue_map() return NULL > on any failure, so the error returned from vring_alloc_queue_split() > is lost and turned into -ENOMEM. This is especially misleading if > vring_alloc_queue_split() rejects a queue size with -EINVAL (i.e. if > queue size is not a power of two): > > virtio_blk virtio0: Bad virtqueue length 100 > virtio_blk virtio0: probe with driver virtio_blk failed with error -12 > > So the error points whoever debugs it at an allocation failure that > never happened. > > Return an ERR_PTR() instead: the error from vring_alloc_queue_split() > or vring_alloc_queue_packed(), or -ENOMEM when allocating the > virtqueue itself fails. Make the callers, virtio_pci (modern and > legacy), virtio_mmio, virtio_vdpa, virtio_ccw and virtio_uml, check > with IS_ERR() and pass the error on. The error path in virtio_ccw > deletes a non-NULL vq, so clear vq there before taking it. > > Co-Authored-By: Claude Opus 5.5 <[email protected]> > Signed-off-by: Stjepan Poljak <[email protected]>
Sashiko has reviewed this patch and found no issues. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
