linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: fix odd_ptr_err.cocci warnings
@ 2016-02-17 12:29 Julia Lawall
  2016-02-17 12:55 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2016-02-17 12:29 UTC (permalink / raw)
  To: linux-arm-kernel

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

I haven't checked the context in detail. There can be false positives,
when it is the call to IS_ERR that is wrong.

tree:   https://github.com/Broadcom/arm64-linux iproc-tsc-v2
head:   ef32cf1baeb934bfcdf7c9eb8ad345aae266cde5
commit: c3afc7a1c330ce452c52e2183a23b2ab9f70bd4a [2/3] input: syscon
support in bcm_iproc_tsc driver

Please take the patch only if it's a positive warning. Thanks!

 bcm_iproc_tsc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/input/touchscreen/bcm_iproc_tsc.c
+++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
@@ -492,7 +492,7 @@ static int iproc_ts_probe(struct platfor
 						pdev->dev.of_node,
 						"ts_syscon");
 		if (IS_ERR(priv->regmap)) {
-			error = PTR_ERR(priv->regs);
+			error = PTR_ERR(priv->regmap);
 			dev_err(&pdev->dev, "unable to map I/O memory:%d\n",
 				error);
 			return error;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] input: fix odd_ptr_err.cocci warnings
  2016-02-17 12:29 [PATCH] input: " Julia Lawall
@ 2016-02-17 12:55 ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-02-17 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 17 February 2016 07:29:05 Julia Lawall wrote:
> PTR_ERR should access the value just tested by IS_ERR
> 
> Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> 
> I haven't checked the context in detail. There can be false positives,
> when it is the call to IS_ERR that is wrong.
> 
> tree:   https://github.com/Broadcom/arm64-linux iproc-tsc-v2
> head:   ef32cf1baeb934bfcdf7c9eb8ad345aae266cde5
> commit: c3afc7a1c330ce452c52e2183a23b2ab9f70bd4a [2/3] input: syscon
> support in bcm_iproc_tsc driver
> 
> Please take the patch only if it's a positive warning. Thanks!
> 
> 

Looks correct to me

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

>                 if (IS_ERR(priv->regmap)) {
> -                       error = PTR_ERR(priv->regs);
> +                       error = PTR_ERR(priv->regmap);

I think this could have been avoided using

		error = PTR_ERR_OR_ZERO(priv->regmap);
		if (error) {
			...

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Input: fix odd_ptr_err.cocci warnings
       [not found] <202204070801.hNvu3cEu-lkp@intel.com>
@ 2022-04-07  0:09 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-07  0:09 UTC (permalink / raw)
  To: Linus Walleij; +Cc: kbuild-all, linux-arm-kernel

From: kernel test robot <lkp@intel.com>

drivers/input/misc/isa1200.c:327:5-11: inconsistent IS_ERR and PTR_ERR on line 328.
drivers/input/misc/isa1200.c:332:5-11: inconsistent IS_ERR and PTR_ERR on line 333.

 PTR_ERR should access the value just tested by IS_ERR

Semantic patch information:
 There can be false positives in the patch case, where it is the call to
 IS_ERR that is wrong.

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git ux500-janice-v5.18-rc1
head:   7d27ddbe075c07508ab045a63d23aeca798514ee
commit: 0baaba96c1a1116b9fc698a263657cb9b6ab8198 [18/21] Input: isa1200 - new driver for Immersion ISA1200
:::::: branch date: 27 hours ago
:::::: commit date: 29 hours ago

 drivers/input/misc/isa1200.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/input/misc/isa1200.c
+++ b/drivers/input/misc/isa1200.c
@@ -325,12 +325,12 @@ static int isa1200_probe(struct i2c_clie
 
 	isa->hen = devm_gpiod_get(dev, "hen", GPIOD_OUT_LOW);
 	if (IS_ERR(isa->hen)) {
-		ret = PTR_ERR(isa->map);
+		ret = PTR_ERR(isa->hen);
 		return dev_err_probe(dev, ret, "failed to get HEN GPIO\n");
 	}
 	isa->len = devm_gpiod_get(dev, "len", GPIOD_OUT_LOW);
 	if (IS_ERR(isa->hen)) {
-		ret = PTR_ERR(isa->map);
+		ret = PTR_ERR(isa->hen);
 		return dev_err_probe(dev, ret, "failed to get LEN GPIO\n");
 	}
 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-07  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <202204070801.hNvu3cEu-lkp@intel.com>
2022-04-07  0:09 ` [PATCH] Input: fix odd_ptr_err.cocci warnings kernel test robot
2016-02-17 12:29 [PATCH] input: " Julia Lawall
2016-02-17 12:55 ` Arnd Bergmann

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).