diff mbox series

[v1] virtio-gpu: Correct virgl_renderer_resource_get_info() error check

Message ID 20240127215253.227583-1-dmitry.osipenko@collabora.com (mailing list archive)
State New, archived
Headers show
Series [v1] virtio-gpu: Correct virgl_renderer_resource_get_info() error check | expand

Commit Message

Dmitry Osipenko Jan. 27, 2024, 9:52 p.m. UTC
virgl_renderer_resource_get_info() returns errno and not -1 on error.
Correct the return-value check.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 hw/display/virtio-gpu-virgl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Jan. 29, 2024, 7:19 a.m. UTC | #1
On Sun, Jan 28, 2024 at 2:10 AM Dmitry Osipenko
<dmitry.osipenko@collabora.com> wrote:
>
> virgl_renderer_resource_get_info() returns errno and not -1 on error.
> Correct the return-value check.
>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Can you also correct the code in vhost-user-gpu ?

> ---
>  hw/display/virtio-gpu-virgl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> index 8bb7a2c21fe7..9f34d0e6619c 100644
> --- a/hw/display/virtio-gpu-virgl.c
> +++ b/hw/display/virtio-gpu-virgl.c
> @@ -181,7 +181,7 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
>          memset(&info, 0, sizeof(info));
>          ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
>  #endif
> -        if (ret == -1) {
> +        if (ret) {
>              qemu_log_mask(LOG_GUEST_ERROR,
>                            "%s: illegal resource specified %d\n",
>                            __func__, ss.resource_id);
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 8bb7a2c21fe7..9f34d0e6619c 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -181,7 +181,7 @@  static void virgl_cmd_set_scanout(VirtIOGPU *g,
         memset(&info, 0, sizeof(info));
         ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
 #endif
-        if (ret == -1) {
+        if (ret) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: illegal resource specified %d\n",
                           __func__, ss.resource_id);