Commit 4c703f5d authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Gerd Hoffmann

drm/virtio: Return proper error codes instead of -1

Don't return -1 in error cases, return proper error code. The returned
error codes propagate to error messages and to userspace and it's always
good to have a meaningful error number for debugging purposes.
Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-10-dmitry.osipenko@collabora.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent a9d2e8b5
...@@ -322,7 +322,7 @@ static int virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, ...@@ -322,7 +322,7 @@ static int virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
if (fence && vbuf->objs) if (fence && vbuf->objs)
virtio_gpu_array_unlock_resv(vbuf->objs); virtio_gpu_array_unlock_resv(vbuf->objs);
free_vbuf(vgdev, vbuf); free_vbuf(vgdev, vbuf);
return -1; return -ENODEV;
} }
if (vgdev->has_indirect) if (vgdev->has_indirect)
...@@ -386,7 +386,7 @@ static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, ...@@ -386,7 +386,7 @@ static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
if (!sgt) { if (!sgt) {
if (fence && vbuf->objs) if (fence && vbuf->objs)
virtio_gpu_array_unlock_resv(vbuf->objs); virtio_gpu_array_unlock_resv(vbuf->objs);
return -1; return -ENOMEM;
} }
elemcnt += sg_ents; elemcnt += sg_ents;
...@@ -720,7 +720,7 @@ static int virtio_get_edid_block(void *data, u8 *buf, ...@@ -720,7 +720,7 @@ static int virtio_get_edid_block(void *data, u8 *buf,
size_t start = block * EDID_LENGTH; size_t start = block * EDID_LENGTH;
if (start + len > le32_to_cpu(resp->size)) if (start + len > le32_to_cpu(resp->size))
return -1; return -EINVAL;
memcpy(buf, resp->edid + start, len); memcpy(buf, resp->edid + start, len);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment