media: i2c: fix odd_ptr_err.cocci warnings
Subsystems (3)
PATCH 1/1 media: i2c: fix odd_ptr_err.cocci warnings
From: kernel test robot <[email protected]>
PTR_ERR should access the value just tested by IS_ERR
Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b3a3cbdec55b090d22a09f75efb7c7d34cb97f25 commit: 11c0d8fdccc56fa15cb15906480b4737c31dd085 [2650/3956] media: i2c: Add support for the OV8865 image sensor
:::::: branch date: 2 days ago
:::::: commit date: 4 days ago
ov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov8865.c +1 -1
@@ -2849,7 +2849,7 @@ static int ov8865_probe(struct i2c_clien sensor->avdd =devm_regulator_get (dev,"avdd" );if (IS_ERR (sensor->avdd)) {dev_err (dev,"cannot get AVDD (analog) regulator\n" ); - ret =PTR_ERR (sensor->dvdd); + ret =PTR_ERR (sensor->avdd); goto error_endpoint; }
Hi,
Quoted 3 lines · Julia Lawall
From: kernel test robot <[email protected]>
PTR_ERRshould access the value just tested byIS_ERR
Good catch!
Cheers,
Paul
Quoted 29 lines
Generated by:
scripts/coccinelle/tests/odd_ptr_err.cocciFixes 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor")CC Paul Kocialkowski <[email protected]>Reported-by kernel test robot <[email protected]>Signed-off-by kernel test robot <[email protected]>Signed-off-by Julia Lawall <[email protected]>---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b3a3cbdec55b090d22a09f75efb7c7d34cb97f25 commit: 11c0d8fdccc56fa15cb15906480b4737c31dd085 [2650/3956] media: i2c: Add support for the OV8865 image sensor:::::: branch date: 2 days ago
:::::: commit date: 4 days agoov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ov8865.c +1
-1@@ -2849,7 +2849,7 @@ static int ov8865_probe(struct i2c_clien sensor->avdd =devm_regulator_get (dev,"avdd" );if (IS_ERR (sensor->avdd)) {dev_err (dev,"cannot get AVDD (analog) regulator\n" ); - ret =PTR_ERR (sensor->dvdd); + ret =PTR_ERR (sensor->avdd); goto error_endpoint; }
Signature · 3 lines
Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Sakari Ailus
maintainerQuoted 10 lines · Paul Kocialkowski
Hi,
Quoted 3 lines · Julia Lawall
From: kernel test robot <[email protected]>
PTR_ERRshould access the value just tested byIS_ERRGood catch!
Reviewed-by Paul Kocialkowski <[email protected]>
Thanks, Julia and Paul.
A patch with similar content got recently merged:
commit 6e7cca2790a54057ddf64da7843271e192f71ca0
Author: Hans Verkuil <[email protected]> Date: Wed Jan 20 09:42:38 2021 +0100
media: i2c/ov8865.c: fix error checks using wrong variable
Fix two typos: dvdd -> dovdd and dvdd -> avdd
Both clearly copy-and-paste mistakes.
Fixes this smatch warning:
drivers/media/i2c/ov8865.c:2852 ov8865_probe() warn: passing zero to 'PTR_ERR'
Signature · 3 lines
Kind regards, Sakari Ailus