linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Cc: "Christopher Díaz Riveros" <chrisadr@gentoo.org>,
	sudeep.dutt@intel.com, ashutosh.dixit@intel.com, arnd@arndb.de,
	gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH-next] misc: mic: Use PTR_ERR_OR_ZERO
Date: Wed, 24 Jan 2018 09:16:48 +0100	[thread overview]
Message-ID: <5A6840F0.9090201@bfs.de> (raw)
In-Reply-To: <20180123201009.12998-1-chrisadr@gentoo.org>



Am 23.01.2018 21:10, schrieb Christopher Díaz Riveros:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
> ---
>  drivers/misc/mic/scif/scif_epd.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/misc/mic/scif/scif_epd.h b/drivers/misc/mic/scif/scif_epd.h
> index f39b663da287..b2a835665390 100644
> --- a/drivers/misc/mic/scif/scif_epd.h
> +++ b/drivers/misc/mic/scif/scif_epd.h
> @@ -165,9 +165,7 @@ static inline int scif_verify_epd(struct scif_endpt *ep)
>  static inline int scif_anon_inode_getfile(scif_epd_t epd)
>  {
>  	epd->anon = anon_inode_getfile("scif", &scif_anon_fops, NULL, 0);
> -	if (IS_ERR(epd->anon))
> -		return PTR_ERR(epd->anon);
> -	return 0;
> +	return PTR_ERR_OR_ZERO(epd->anon);
>  }
>  

the patch looks ok,
but someone should thing about if it makes sense to have a oneliner as function.
IMHO this will only confuse readers (note: yes, there are reasons in some cases,
but i do not see what applies here if any).

re,
 wh

>  static inline void scif_anon_inode_fput(scif_epd_t epd)

  parent reply	other threads:[~2018-01-24  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 20:10 [PATCH-next] misc: mic: Use PTR_ERR_OR_ZERO Christopher Díaz Riveros
2018-01-23 21:55 ` Al Viro
2018-01-27  3:45   ` Ashutosh Dixit
2018-01-24  8:16 ` walter harms [this message]
2018-01-23 20:14 Christopher Díaz Riveros

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=5A6840F0.9090201@bfs.de \
    --to=wharms@bfs.de \
    --cc=arnd@arndb.de \
    --cc=ashutosh.dixit@intel.com \
    --cc=chrisadr@gentoo.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.dutt@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).