All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Julia Lawall <julia.lawall@lip6.fr>,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	netdev@vger.kernel.org, alsa-devel@alsa-project.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH] treewide: remove redundent IS_ERR() before error code check
Date: Mon, 6 Jan 2020 21:15:21 -0800	[thread overview]
Message-ID: <20200107051521.GF705@sol.localdomain> (raw)
In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org>

On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote:
> 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p).
> Hence, IS_ERR(p) is unneeded.
> 
> The semantic patch that generates this commit is as follows:
> 
> // <smpl>
> @@
> expression ptr;
> constant error_code;
> @@
> -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code)
> +PTR_ERR(ptr) == - error_code
> // </smpl>
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Any reason for not doing instead:

	ptr == ERR_PTR(-error_code)

?  To me it seems weird to use PTR_ERR() on non-error pointers.  I even had to
double check that it returns a 'long' and not an 'int'.  (If it returned an
'int', it wouldn't work...)

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-acpi@vger.kernel.org, netdev@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>,
	linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-i2c@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH] treewide: remove redundent IS_ERR() before error code check
Date: Mon, 6 Jan 2020 21:15:21 -0800	[thread overview]
Message-ID: <20200107051521.GF705@sol.localdomain> (raw)
In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org>

On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote:
> 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p).
> Hence, IS_ERR(p) is unneeded.
> 
> The semantic patch that generates this commit is as follows:
> 
> // <smpl>
> @@
> expression ptr;
> constant error_code;
> @@
> -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code)
> +PTR_ERR(ptr) == - error_code
> // </smpl>
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Any reason for not doing instead:

	ptr == ERR_PTR(-error_code)

?  To me it seems weird to use PTR_ERR() on non-error pointers.  I even had to
double check that it returns a 'long' and not an 'int'.  (If it returned an
'int', it wouldn't work...)

- Eric
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-acpi@vger.kernel.org, netdev@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>,
	linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH] treewide: remove redundent IS_ERR() before error code check
Date: Mon, 6 Jan 2020 21:15:21 -0800	[thread overview]
Message-ID: <20200107051521.GF705@sol.localdomain> (raw)
In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org>

On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote:
> 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p).
> Hence, IS_ERR(p) is unneeded.
> 
> The semantic patch that generates this commit is as follows:
> 
> // <smpl>
> @@
> expression ptr;
> constant error_code;
> @@
> -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code)
> +PTR_ERR(ptr) == - error_code
> // </smpl>
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Any reason for not doing instead:

	ptr == ERR_PTR(-error_code)

?  To me it seems weird to use PTR_ERR() on non-error pointers.  I even had to
double check that it returns a 'long' and not an 'int'.  (If it returned an
'int', it wouldn't work...)

- Eric

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-acpi@vger.kernel.org, netdev@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>,
	linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH] treewide: remove redundent IS_ERR() before error code check
Date: Mon, 6 Jan 2020 21:15:21 -0800	[thread overview]
Message-ID: <20200107051521.GF705@sol.localdomain> (raw)
In-Reply-To: <20200106045833.1725-1-masahiroy@kernel.org>

On Mon, Jan 06, 2020 at 01:58:33PM +0900, Masahiro Yamada wrote:
> 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p).
> Hence, IS_ERR(p) is unneeded.
> 
> The semantic patch that generates this commit is as follows:
> 
> // <smpl>
> @@
> expression ptr;
> constant error_code;
> @@
> -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code)
> +PTR_ERR(ptr) == - error_code
> // </smpl>
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Any reason for not doing instead:

	ptr == ERR_PTR(-error_code)

?  To me it seems weird to use PTR_ERR() on non-error pointers.  I even had to
double check that it returns a 'long' and not an 'int'.  (If it returned an
'int', it wouldn't work...)

- Eric

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-01-07  5:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06  4:58 [PATCH] treewide: remove redundent IS_ERR() before error code check Masahiro Yamada
2020-01-06  4:58 ` Masahiro Yamada
2020-01-06  4:58 ` Masahiro Yamada
2020-01-06  4:58 ` [alsa-devel] " Masahiro Yamada
2020-01-06  4:58 ` Masahiro Yamada
2020-01-06  6:02 ` Stephen Boyd
2020-01-06  6:02   ` Stephen Boyd
2020-01-06  6:02   ` Stephen Boyd
2020-01-06  6:02   ` [alsa-devel] " Stephen Boyd
2020-01-06  6:02   ` Stephen Boyd
2020-01-06  9:38 ` Bartosz Golaszewski
2020-01-06  9:38   ` Bartosz Golaszewski
2020-01-06  9:38   ` Bartosz Golaszewski
2020-01-06  9:38   ` [alsa-devel] " Bartosz Golaszewski
2020-01-06 10:05 ` Wolfram Sang
2020-01-06 10:05   ` Wolfram Sang
2020-01-06 10:05   ` Wolfram Sang
2020-01-06 10:05   ` [alsa-devel] " Wolfram Sang
2020-01-07  5:15 ` Eric Biggers [this message]
2020-01-07  5:15   ` Eric Biggers
2020-01-07  5:15   ` Eric Biggers
2020-01-07  5:15   ` [alsa-devel] " Eric Biggers
2020-01-07  6:28   ` Masahiro Yamada
2020-01-07  6:28     ` Masahiro Yamada
2020-01-07  6:28     ` Masahiro Yamada
2020-01-07  6:28     ` [alsa-devel] " Masahiro Yamada
2020-01-07  9:52 ` Rafael J. Wysocki
2020-01-07  9:52   ` Rafael J. Wysocki
2020-01-07  9:52   ` Rafael J. Wysocki
2020-01-07  9:52   ` [alsa-devel] " Rafael J. Wysocki
2020-01-07  9:52   ` Rafael J. Wysocki
2020-01-08 20:17 ` Rob Herring
2020-01-08 20:17   ` Rob Herring
2020-01-08 20:17   ` Rob Herring
2020-01-08 20:17   ` [alsa-devel] " Rob Herring
2020-01-08 20:17   ` Rob Herring

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=20200107051521.GF705@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=devicetree@vger.kernel.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=masahiroy@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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.