]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
driver/virtio/mmio: Make config_get return value consistent with PCI
authorMichalis Pappas <michalis@unikraft.io>
Mon, 25 Sep 2023 14:57:02 +0000 (16:57 +0200)
committerRazvan Deaconescu <razvand@unikraft.io>
Fri, 20 Oct 2023 16:35:55 +0000 (19:35 +0300)
Update the return value of virtio-mmio ops->config_get to return zero
on success rather like the number of bytes read, to align with virtio-pci.
This allows consistent error handling from device driver side.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

drivers/virtio/mmio/virtio_mmio.c

index 592baefbbc271c33d42be7bfdb4f6a5a159bd23d..4d3d64fc3ea0ed3b10a105609fd48b2b67336757 100644 (file)
@@ -144,7 +144,7 @@ static int vm_get(struct virtio_dev *vdev, __u16 offset,
 
                for (i = 0; i < len; i++)
                        ptr[i] = virtio_mmio_cread8(base, offset + i);
-               return len;
+               return 0;
        }
 
        switch (len) {
@@ -171,7 +171,7 @@ static int vm_get(struct virtio_dev *vdev, __u16 offset,
                uk_pr_warn("Unaligned io read: %d bytes\n", len);
        }
 
-       return len;
+       return 0;
 }
 
 static int vm_set(struct virtio_dev *vdev, __u16 offset,