dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bence Csokas" <bence.csokas@arm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/syncobj: Use scope-based cleanup for eventfd_ctx
Date: Tue, 15 Sep 2026 11:16:26 +0000	[thread overview]
Message-ID: <20260915111626.D2EAF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915-efd-autofree-v2-2-06d2c9d1547f@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] cleanup: mixing goto and scope-based cleanup in drm_syncobj_eventfd_ioctl
--

commit ff6fd047e86cd28041b0ce12099546c46df110b2
Author: Bence Csokas <bence.csokas@arm.com>

drm/syncobj: Use scope-based cleanup for eventfd_ctx

This patch converts the eventfd context in drm_syncobj_eventfd_ioctl() to
use scope-based cleanup now that eventfd supports it.

> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index c23a5de27effa..efc4e8af220c8 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -1462,9 +1462,9 @@ int
>  drm_syncobj_eventfd_ioctl(struct drm_device *dev, void *data,
>  			  struct drm_file *file_private)
>  {
> +	struct eventfd_ctx *ev_fd_ctx __free(eventfd) = NULL;
>  	struct drm_syncobj_eventfd *args = data;
>  	struct drm_syncobj *syncobj;

[ ... ]

> @@ -1490,10 +1490,10 @@ drm_syncobj_eventfd_ioctl(struct drm_device *dev, void *data,
>  	entry = kzalloc_obj(*entry);
>  	if (!entry) {
>  		ret = -ENOMEM;
> -		goto err_kzalloc;
> +		goto err_fdget;

[Severity: Medium]
Does this mix goto-based error handling and scope-based cleanup within
drm_syncobj_eventfd_ioctl()?

According to include/linux/cleanup.h, the expectation is that usage of
goto and cleanup helpers is never mixed in the same function. All resources
that need cleanup should either be converted to scope-based cleanup, or
none of them.

Leaving the err_fdget label to manually call drm_syncobj_put(syncobj)
while using __free(eventfd) for ev_fd_ctx can lead to confusing resource
ownership and break the expected LIFO teardown ordering.

Could syncobj be converted to use scope-based cleanup as well?

>  	}
>  	entry->syncobj = syncobj;
> -	entry->ev_fd_ctx = ev_fd_ctx;
> +	entry->ev_fd_ctx = no_free_ptr(ev_fd_ctx);
>  	entry->point = args->point;
>  	entry->flags = args->flags;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915-efd-autofree-v2-0-06d2c9d1547f@arm.com?part=2

      reply	other threads:[~2026-09-15 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 11:09 [PATCH v2 0/2] Add scope-based cleanup capability to eventfd_ctx Bence Csokas
2026-09-15 11:09 ` [PATCH v2 1/2] eventfd: Add scope-based cleanup capability Bence Csokas
2026-09-15 11:09 ` [PATCH v2 2/2] drm/syncobj: Use scope-based cleanup for eventfd_ctx Bence Csokas
2026-09-15 11:16   ` sashiko-bot [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=20260915111626.D2EAF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bence.csokas@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@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