public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: cgel.zte@gmail.com, airlied@linux.ie
Cc: tzimmermann@suse.de, ye xingchen <ye.xingchen@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Maxime Ripard <maxime@cerno.tech>,
	Thierry Reding <treding@nvidia.com>,
	Julia Lawall <julia.lawall@inria.fr>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH linux-next] drm/gem: Remove the unneeded result variable
Date: Wed, 31 Aug 2022 12:25:52 +0300	[thread overview]
Message-ID: <8735dcepcv.fsf@intel.com> (raw)
In-Reply-To: <20220831033301.302121-1-ye.xingchen@zte.com.cn>

On Wed, 31 Aug 2022, cgel.zte@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Return the value drm_gem_handle_delete() directly instead of storing it
> in another redundant variable.

Personally, I generally prefer keeping these types of variables, because
they make future changes on the code easier. For example, adding a new
call where you need to check the return value, or having to deal with
the error value right there. Or just adding ad hoc debug logging of the
return value.

Related, but not exactly the same, see commit b784c7707502
("coccinnelle: Remove ptr_ret script"). Adding Cc's from that commit for
input.

BR,
Jani.

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>  drivers/gpu/drm/drm_gem.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index ad068865ba20..3fa0deff3014 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -782,14 +782,11 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
>  		    struct drm_file *file_priv)
>  {
>  	struct drm_gem_close *args = data;
> -	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_GEM))
>  		return -EOPNOTSUPP;
>  
> -	ret = drm_gem_handle_delete(file_priv, args->handle);
> -
> -	return ret;
> +	return drm_gem_handle_delete(file_priv, args->handle);
>  }
>  
>  /**

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-08-31  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  3:33 [PATCH linux-next] drm/gem: Remove the unneeded result variable cgel.zte
2022-08-31  9:25 ` Jani Nikula [this message]
2022-08-31 12:02   ` Thierry Reding

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=8735dcepcv.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=broonie@kernel.org \
    --cc=cgel.zte@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=treding@nvidia.com \
    --cc=tzimmermann@suse.de \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=ye.xingchen@zte.com.cn \
    --cc=zealci@zte.com.cn \
    /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