From: Markus Elfring <Markus.Elfring@web.de>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
virtualization@lists.linux.dev, dri-devel@lists.freedesktop.org,
Chia-I Wu <olvaffe@gmail.com>, David Airlie <airlied@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Gurchetan Singh <gurchetansingh@chromium.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Simona Vetter <simona@ffwll.ch>,
Thomas Zimmermann <tzimmermann@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/virtio: Use common error handling code in two functions
Date: Wed, 17 Jun 2026 18:13:20 +0200 [thread overview]
Message-ID: <8e4ba35a-534d-4eaa-882d-4998b7371f2d@web.de> (raw)
In-Reply-To: <54d6527d-30c2-4e73-846d-c0e5276c8f74@collabora.com>
>> Use additional labels so that a bit of exception handling can be better
>> reused at the end of two function implementations.
…
>> +++ b/drivers/gpu/drm/virtio/virtgpu_vram.c
>> @@ -212,16 +212,12 @@ int virtio_gpu_vram_create(struct virtio_gpu_device *vgdev,
>>
>> /* Create fake offset */
>> ret = drm_gem_create_mmap_offset(obj);
>> - if (ret) {
>> - kfree(vram);
>> - return ret;
>> - }
>> + if (ret)
>> + goto free_vram;
>>
>> ret = virtio_gpu_resource_id_get(vgdev, &vram->base.hw_res_handle);
>> - if (ret) {
>> - kfree(vram);
>> - return ret;
>> - }
>> + if (ret)
>> + goto free_vram;
>>
>> virtio_gpu_cmd_resource_create_blob(vgdev, &vram->base, params, NULL,
>> 0);
>> @@ -237,6 +233,10 @@ int virtio_gpu_vram_create(struct virtio_gpu_device *vgdev,
>>
>> *bo_ptr = &vram->base;
>> return 0;
>> +
>> +free_vram:
>> + kfree(vram);
>> + return ret;
>> }
>>
>> void virtio_gpu_vram_map_deferred(struct virtio_gpu_object_vram *vram)
>
> Please see [1], will be great if you could address the reported issues
> with this patch in v2
Do you indicate that you would prefer an other coding style for the application
of goto chains?
> and add another patch fixing the
> virtio_gpu_resource_id_get() error handling.
>
> [1]
> https://sashiko.dev/#/patchset/b7440806-e9e8-4027-afe1-f6fe9297d8b2%40web.de
Do you request to achieve corresponding resource cleanup after a failed
virtio_gpu_resource_id_get() call by any other function call instead of kfree(vram)?
Regards,
Markus
prev parent reply other threads:[~2026-06-17 16:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 18:08 [PATCH] drm/virtio: Use common error handling code in two functions Markus Elfring
2026-06-17 15:11 ` Dmitry Osipenko
2026-06-17 16:13 ` Markus Elfring [this message]
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=8e4ba35a-534d-4eaa-882d-4998b7371f2d@web.de \
--to=markus.elfring@web.de \
--cc=airlied@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=olvaffe@gmail.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox