All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Lyude Paul" <lyude@redhat.com>, "Timur Tabi" <ttabi@nvidia.com>
Cc: <dri-devel@lists.freedesktop.org>,
	<nouveau@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	"Dave Airlie" <airlied@redhat.com>,
	"Qianfeng Rong" <rongqianfeng@vivo.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Kees Cook" <kees@kernel.org>, "Simona Vetter" <simona@ffwll.ch>,
	"David Airlie" <airlied@gmail.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Hongling Zeng" <zenghongling@kylinos.cn>,
	"Zhi Wang" <zhiw@nvidia.com>
Subject: Re: [PATCH 0/5] Revert cleanups for IS_ERR_OR_NULL() usage
Date: Thu, 28 May 2026 21:44:52 +0200	[thread overview]
Message-ID: <DIUKG7F2VAC7.17L4VHNNI7YL2@kernel.org> (raw)
In-Reply-To: <20260528192847.4077458-1-lyude@redhat.com>

On Thu May 28, 2026 at 9:27 PM CEST, Lyude Paul wrote:
> Lyude Paul (5):
>   Revert "nouveau/gsp/rm: cleanup remaining IS_ERR_OR_NULL usage"
>   Revert "nouveau/gsp/rm: cleanup IS_ERR_OR_NULL in core implementation"
>   Revert "nouveau/gsp/rm: cleanup WARN_ON(IS_ERR_OR_NULL)"
>   Revert "nouveau/gsp: cleanup IS_ERR_OR_NULL in rpc_rd"
>   Revert "nouveau/gsp: cleanup IS_ERR_OR_NULL in rm_alloc functions"

Reverting the whole thing for now is the right call, as it needs some more
review.

@Timur: I do think cleaning this up is the right call in general though, and I
also don't think that the whole driver necessarily needs to be consistent on
whether IS_ERR_OR_NULL() or IS_ERR() is used -- it depends on the context
(although I usually prefer not to mix up NULL and ERR semantics in the first
place).

It should however be consistent in terms of what functions can actually return.

	ret = foo();
	if (IS_ERR_OR_NULL(ret))
		return ret;

If foo() can never return NULL, the above is misleading, as it puts an
obligation on the caller to somehow handle the NULL case and come up with an
actual error code for it.

So, I think it is the right call to align that to what functions can actually
return, but while doing this, the contract should be properly documented, such
that subsequent changes can be properly validated.

I can pick this up later, but in case you want to pick it up Lyude, note that
this now has to go into drm-misc-next-fixes.

Thanks,
Danilo

WARNING: multiple messages have this Message-ID (diff)
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Lyude Paul" <lyude@redhat.com>, "Timur Tabi" <ttabi@nvidia.com>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
	Qianfeng Rong <rongqianfeng@vivo.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Kees Cook <kees@kernel.org>, Simona Vetter <simona@ffwll.ch>,
	Maxime Ripard <mripard@kernel.org>,
	Hongling Zeng <zenghongling@kylinos.cn>,
	Zhi Wang <zhiw@nvidia.com>
Subject: Re: [PATCH 0/5] Revert cleanups for IS_ERR_OR_NULL() usage
Date: Thu, 28 May 2026 21:44:52 +0200	[thread overview]
Message-ID: <DIUKG7F2VAC7.17L4VHNNI7YL2@kernel.org> (raw)
In-Reply-To: <20260528192847.4077458-1-lyude@redhat.com>

On Thu May 28, 2026 at 9:27 PM CEST, Lyude Paul wrote:
> Lyude Paul (5):
>   Revert "nouveau/gsp/rm: cleanup remaining IS_ERR_OR_NULL usage"
>   Revert "nouveau/gsp/rm: cleanup IS_ERR_OR_NULL in core implementation"
>   Revert "nouveau/gsp/rm: cleanup WARN_ON(IS_ERR_OR_NULL)"
>   Revert "nouveau/gsp: cleanup IS_ERR_OR_NULL in rpc_rd"
>   Revert "nouveau/gsp: cleanup IS_ERR_OR_NULL in rm_alloc functions"

Reverting the whole thing for now is the right call, as it needs some more
review.

@Timur: I do think cleaning this up is the right call in general though, and I
also don't think that the whole driver necessarily needs to be consistent on
whether IS_ERR_OR_NULL() or IS_ERR() is used -- it depends on the context
(although I usually prefer not to mix up NULL and ERR semantics in the first
place).

It should however be consistent in terms of what functions can actually return.

	ret = foo();
	if (IS_ERR_OR_NULL(ret))
		return ret;

If foo() can never return NULL, the above is misleading, as it puts an
obligation on the caller to somehow handle the NULL case and come up with an
actual error code for it.

So, I think it is the right call to align that to what functions can actually
return, but while doing this, the contract should be properly documented, such
that subsequent changes can be properly validated.

I can pick this up later, but in case you want to pick it up Lyude, note that
this now has to go into drm-misc-next-fixes.

Thanks,
Danilo

  parent reply	other threads:[~2026-05-28 19:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 19:27 [PATCH 0/5] Revert cleanups for IS_ERR_OR_NULL() usage Lyude Paul
2026-05-28 19:27 ` Lyude Paul
2026-05-28 19:27 ` [PATCH 1/5] Revert "nouveau/gsp/rm: cleanup remaining IS_ERR_OR_NULL usage" Lyude Paul
2026-05-28 19:27   ` Lyude Paul
2026-05-28 19:27 ` [PATCH 2/5] Revert "nouveau/gsp/rm: cleanup IS_ERR_OR_NULL in core implementation" Lyude Paul
2026-05-28 19:27   ` Lyude Paul
2026-05-28 19:27 ` [PATCH 3/5] Revert "nouveau/gsp/rm: cleanup WARN_ON(IS_ERR_OR_NULL)" Lyude Paul
2026-05-28 19:27   ` Lyude Paul
2026-05-28 19:27 ` [PATCH 4/5] Revert "nouveau/gsp: cleanup IS_ERR_OR_NULL in rpc_rd" Lyude Paul
2026-05-28 19:27   ` Lyude Paul
2026-05-28 19:27 ` [PATCH 5/5] Revert "nouveau/gsp: cleanup IS_ERR_OR_NULL in rm_alloc functions" Lyude Paul
2026-05-28 19:27   ` Lyude Paul
2026-05-28 19:44 ` Danilo Krummrich [this message]
2026-05-28 19:44   ` [PATCH 0/5] Revert cleanups for IS_ERR_OR_NULL() usage Danilo Krummrich
2026-05-28 19:49   ` lyude
2026-05-28 19:49     ` lyude
2026-05-28 20:23   ` Timur Tabi
2026-05-28 20:23     ` Timur Tabi
2026-05-28 20:48     ` Danilo Krummrich
2026-05-28 20:48       ` Danilo Krummrich
2026-05-28 20:12 ` Timur Tabi
2026-05-28 20:12   ` Timur Tabi
2026-05-28 21:07 ` Danilo Krummrich
2026-05-28 21:07   ` Danilo Krummrich

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=DIUKG7F2VAC7.17L4VHNNI7YL2@kernel.org \
    --to=dakr@kernel.org \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rongqianfeng@vivo.com \
    --cc=simona@ffwll.ch \
    --cc=ttabi@nvidia.com \
    --cc=tzimmermann@suse.de \
    --cc=zenghongling@kylinos.cn \
    --cc=zhiw@nvidia.com \
    /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.