pvcalls-front: don't return error when the ring is full
authorStefano Stabellini <sstabellini@kernel.org>
Fri, 21 Dec 2018 23:06:32 +0000 (15:06 -0800)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 2 Jan 2019 16:00:31 +0000 (11:00 -0500)
When the ring is full, size == array_size. It is not an error condition,
so simply return 0 instead of an error.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/pvcalls-front.c

index 01588582ae66311f7ce9df6e639cf08e116c280f..1a893a164349045bcf5801f162b1ecde08cb7851 100644 (file)
@@ -475,8 +475,10 @@ static int __write_ring(struct pvcalls_data_intf *intf,
        virt_mb();
 
        size = pvcalls_queued(prod, cons, array_size);
-       if (size >= array_size)
+       if (size > array_size)
                return -EINVAL;
+       if (size == array_size)
+               return 0;
        if (len > array_size - size)
                len = array_size - size;