virtio-gpu: Correct virgl_renderer_resource_get_info() error check

virgl_renderer_resource_get_info() returns errno and not -1 on error.
Correct the return-value check.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Message-Id: <20240129073921.446869-1-dmitry.osipenko@collabora.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Dmitry Osipenko 2024-01-29 10:39:21 +03:00 committed by Michael S. Tsirkin
parent 8700ee15de
commit 574b64aa67
2 changed files with 4 additions and 4 deletions

View File

@ -327,7 +327,7 @@ virgl_get_resource_info_modifiers(uint32_t resource_id,
#ifdef VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION #ifdef VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION
struct virgl_renderer_resource_info_ext info_ext; struct virgl_renderer_resource_info_ext info_ext;
ret = virgl_renderer_resource_get_info_ext(resource_id, &info_ext); ret = virgl_renderer_resource_get_info_ext(resource_id, &info_ext);
if (ret < 0) { if (ret) {
return ret; return ret;
} }
@ -335,7 +335,7 @@ virgl_get_resource_info_modifiers(uint32_t resource_id,
*modifiers = info_ext.modifiers; *modifiers = info_ext.modifiers;
#else #else
ret = virgl_renderer_resource_get_info(resource_id, info); ret = virgl_renderer_resource_get_info(resource_id, info);
if (ret < 0) { if (ret) {
return ret; return ret;
} }
@ -372,7 +372,7 @@ virgl_cmd_set_scanout(VuGpu *g,
uint64_t modifiers = 0; uint64_t modifiers = 0;
ret = virgl_get_resource_info_modifiers(ss.resource_id, &info, ret = virgl_get_resource_info_modifiers(ss.resource_id, &info,
&modifiers); &modifiers);
if (ret == -1) { if (ret) {
g_critical("%s: illegal resource specified %d\n", g_critical("%s: illegal resource specified %d\n",
__func__, ss.resource_id); __func__, ss.resource_id);
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;

View File

@ -181,7 +181,7 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
ret = virgl_renderer_resource_get_info(ss.resource_id, &info); ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
#endif #endif
if (ret == -1) { if (ret) {
qemu_log_mask(LOG_GUEST_ERROR, qemu_log_mask(LOG_GUEST_ERROR,
"%s: illegal resource specified %d\n", "%s: illegal resource specified %d\n",
__func__, ss.resource_id); __func__, ss.resource_id);