From: Markus Armbruster <armbru@redhat.com>
To: Honglei Huang <honghuan@amd.com>
Cc: <alex.bennee@linaro.org>, <dmitry.osipenko@collabora.com>,
<odaki@rsg.ci.i.u-tokyo.ac.jp>, <mst@redhat.com>,
<cohuck@redhat.com>, <pbonzini@redhat.com>,
<qemu-devel@nongnu.org>, <Ray.Huang@amd.com>
Subject: Re: [v4] virtio-gpu: use consistent error checking style for virtio_gpu_create_mapping_iov
Date: Mon, 17 Nov 2025 12:53:37 +0100 [thread overview]
Message-ID: <87zf8kq3i6.fsf@pond.sub.org> (raw)
In-Reply-To: <20251117105104.258513-1-honghuan@amd.com> (Honglei Huang's message of "Mon, 17 Nov 2025 18:51:04 +0800")
Honglei Huang <honghuan@amd.com> writes:
> Fix error handling logic in virgl_cmd_resource_create_blob and improve
> consistency across the codebase.
>
> virtio_gpu_create_mapping_iov() returns 0 on success and negative values
> on error, but the original code was inconsistently checking for error
> conditions using different patterns.
>
> Change all virtio_gpu_create_mapping_iov() error checks to use consistent
> 'ret < 0' or 'ret >= 0' patterns, following the preferred QEMU coding
> convention for functions that return 0 on success and negative on error.
> This makes the return value convention immediately clear to code readers
> without needing to look up the function definition.
>
> Updated locations:
> - hw/display/virtio-gpu-virgl.c: virgl_cmd_resource_create_blob()
> - hw/display/virtio-gpu-virgl.c: virgl_cmd_resource_attach_backing()
> - hw/display/virtio-gpu.c: virtio_gpu_resource_create_blob()
> - hw/display/virtio-gpu.c: virtio_gpu_resource_attach_backing()
> - hw/display/virtio-gpu-rutabaga.c: rutabaga_cmd_attach_backing()
> - hw/display/virtio-gpu-rutabaga.c: rutabaga_cmd_resource_create_blob()
>
> Changes since v3:
> - Extended consistency improvements to virtio-gpu-rutabaga.c
> - Changed CHECK(!ret) to CHECK(ret >= 0) and CHECK(!result) to
> CHECK(result >= 0) in rutabaga functions for consistency
> - Now covers all virtio-gpu files that use virtio_gpu_create_mapping_iov()
>
> Changes since v2:
> - Use 'if (ret < 0)' instead of 'if (ret != 0)' following maintainer's
> feedback on preferred QEMU coding style for error checking functions
> that return 0 on success and negative on error
> - Updated all similar usages across virtio-gpu files for consistency
> - Expanded scope from single function fix to codebase-wide style consistency
>
> Fixes: 7c092f17ccee ("virtio-gpu: Handle resource blob commands")
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2025-11-17 11:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 10:51 [v4] virtio-gpu: use consistent error checking style for virtio_gpu_create_mapping_iov Honglei Huang
2025-11-17 11:53 ` Markus Armbruster [this message]
2025-11-17 12:03 ` Dmitry Osipenko
2025-11-17 13:22 ` Markus Armbruster
2025-11-18 1:48 ` Dmitry Osipenko
2025-11-18 5:45 ` Markus Armbruster
2025-11-20 2:51 ` Dmitry Osipenko
2025-11-18 12:32 ` Honglei Huang
2025-11-19 19:16 ` Dmitry Osipenko
2025-11-20 1:29 ` Akihiko Odaki
2025-11-20 2:45 ` Dmitry Osipenko
2025-11-20 1:31 ` Honglei Huang
2025-11-20 2:03 ` Dmitry Osipenko
-- strict thread matches above, loose matches on Subject: below --
2025-11-21 7:58 Honglei Huang
2025-11-21 8:14 ` Honglei Huang
2025-11-21 18:00 ` Dmitry Osipenko
2025-11-24 1:42 ` Honglei Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zf8kq3i6.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=Ray.Huang@amd.com \
--cc=alex.bennee@linaro.org \
--cc=cohuck@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=honghuan@amd.com \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.