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

Dmitry Osipenko posted 1 patch 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240127215253.227583-1-dmitry.osipenko@collabora.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
There is a newer version of this series
hw/display/virtio-gpu-virgl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] virtio-gpu: Correct virgl_renderer_resource_get_info() error check
Posted by Dmitry Osipenko 10 months ago
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(-)

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
Re: [PATCH v1] virtio-gpu: Correct virgl_renderer_resource_get_info() error check
Posted by Marc-André Lureau 10 months ago
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
>