linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	zhengbin <zhengbin13@huawei.com>,
	Julia Lawall <julia.lawall@lip6.fr>
Cc: airlied@linux.ie, dri-devel@lists.freedesktop.org,
	jonathanh@nvidia.com, linux-tegra@vger.kernel.org,
	treding@nvidia.com
Subject: Re: [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code
Date: Tue, 19 Nov 2019 13:44:06 +0200	[thread overview]
Message-ID: <87wobwxf95.fsf@intel.com> (raw)
In-Reply-To: <20191118132357.GC2246533@ulmo>

On Mon, 18 Nov 2019, Thierry Reding <thierry.reding@gmail.com> wrote:
> On Mon, Nov 18, 2019 at 07:46:10PM +0800, zhengbin wrote:
>> zhengbin (2):
>>   drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in
>>     tegra_bo_dumb_create
>>   drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create
>> 
>>  drivers/gpu/drm/tegra/drm.c | 5 +----
>>  drivers/gpu/drm/tegra/gem.c | 5 +----
>>  2 files changed, 2 insertions(+), 8 deletions(-)
>
> As I explained in response to the same patches sent for other drivers
> already, I don't think this has any merit.

I agree completely.

Apparently there's a coccicheck flagging constructs like this; perhaps
that should be addressed. Julia?

Things like:

drivers/gpu/drm/tegra/gem.c:457:1-3: WARNING: PTR_ERR_OR_ZERO can be used

leading to:

 -	if (IS_ERR(bo))
 -		return PTR_ERR(bo);
 -
 -	return 0;
 +	return PTR_ERR_OR_ZERO(bo);

I think we have consensus the error path and the happy day scenarios
should remain distinct. Moreover, I find PTR_ERR_OR_ZERO() causes me to
pause for a moment while the original is a crystal clear immediately.


BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-11-19 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 11:46 [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code zhengbin
2019-11-18 11:46 ` [PATCH 1/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_bo_dumb_create zhengbin
2019-11-18 11:46 ` [PATCH 2/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code in tegra_gem_create zhengbin
2019-11-18 13:23 ` [PATCH 0/2] drm/tegra: Use PTR_ERR_OR_ZERO() to simplify code Thierry Reding
2019-11-19 11:44   ` Jani Nikula [this message]
2019-11-19 11:52     ` Jani Nikula
2019-11-19 12:40       ` Julia Lawall

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=87wobwxf95.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=treding@nvidia.com \
    --cc=zhengbin13@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).