All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-gpu-virgl: fix error handling in virgl_cmd_resource_create_blob
@ 2025-11-17  5:51 Honglei Huang
  2025-11-17  6:39 ` Akihiko Odaki
  2025-11-17  7:49 ` Markus Armbruster
  0 siblings, 2 replies; 6+ messages in thread
From: Honglei Huang @ 2025-11-17  5:51 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko
  Cc: odaki, mst, cohuck, pbonzini, qemu-devel, Ray.Huang,
	Honglei Huang

The error handling logic was incorrect in virgl_cmd_resource_create_blob.
virtio_gpu_create_mapping_iov() returns 0 on success and non-zero on 
failure, but the code was checking whether to set the error response.

The fix changes the condition from 'if (!ret)' to 'if (ret != 0)' to
properly handle the return value, consistent with other usage patterns
in the same codebase (see virtio-gpu.c:932 and virtio-gpu.c:354).

Signed-off-by: Honglei Huang <honghuan@amd.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 94ddc01f91..e60e1059df 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -701,7 +701,7 @@ static void virgl_cmd_resource_create_blob(VirtIOGPU *g,
         ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob),
                                             cmd, &res->base.addrs,
                                             &res->base.iov, &res->base.iov_cnt);
-        if (!ret) {
+        if (ret != 0) {
             cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
             return;
         }
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-17 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17  5:51 [PATCH] virtio-gpu-virgl: fix error handling in virgl_cmd_resource_create_blob Honglei Huang
2025-11-17  6:39 ` Akihiko Odaki
2025-11-17  7:26   ` Honglei1.Huang@amd.com
2025-11-17  7:49 ` Markus Armbruster
2025-11-17  8:14   ` Honglei Huang
2025-11-17 10:50   ` Honglei Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.