[v0] media: i2c: fix the erroneous pointer initializer

Message ID 20220722022459.5030-1-linma@zju.edu.cn (mailing list archive)
State New
Delegated to: Sakari Ailus
Headers
Series [v0] media: i2c: fix the erroneous pointer initializer |

Commit Message

Lin Ma July 22, 2022, 2:24 a.m. UTC
  There are obvious errors for the initializer of ov02a10_i2c_driver,
ov2682_i2c_driver, and ov5695_i2c_driver as the code intended to assign
"address of function pointer" to function pointer. This patch fixes them
by removing redundant & operators.

Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
 drivers/media/i2c/ov02a10.c | 4 ++--
 drivers/media/i2c/ov2685.c  | 4 ++--
 drivers/media/i2c/ov5695.c  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
  

Comments

Lin Ma July 22, 2022, 3:08 a.m. UTC | #1
Hello there,


> 
> There are obvious errors for the initializer of ov02a10_i2c_driver,
> ov2682_i2c_driver, and ov5695_i2c_driver as the code intended to assign
> "address of function pointer" to function pointer. This patch fixes them
> by removing redundant & operators.
> 
> Signed-off-by: Lin Ma <linma@zju.edu.cn>

Sorry as this is a false alarm :(
I just get confused by the function pointers and function addresses and
the original code works fine.

Regards
Lin
  
sakari.ailus@iki.fi July 23, 2022, 9:17 a.m. UTC | #2
Hi Lin,

On Fri, Jul 22, 2022 at 11:08:01AM +0800, Lin Ma wrote:
> Hello there,
> 
> 
> > 
> > There are obvious errors for the initializer of ov02a10_i2c_driver,
> > ov2682_i2c_driver, and ov5695_i2c_driver as the code intended to assign
> > "address of function pointer" to function pointer. This patch fixes them
> > by removing redundant & operators.
> > 
> > Signed-off-by: Lin Ma <linma@zju.edu.cn>
> 
> Sorry as this is a false alarm :(
> I just get confused by the function pointers and function addresses and
> the original code works fine.

Thanks for the patch.

The original code works fine but functions are always by reference, the
preference is without &.

First patch version is typically 1 and there's no need to denote that.
  

Patch

diff --git a/drivers/media/i2c/ov02a10.c b/drivers/media/i2c/ov02a10.c
index 0f08c05333ea..5d205454ca4e 100644
--- a/drivers/media/i2c/ov02a10.c
+++ b/drivers/media/i2c/ov02a10.c
@@ -1004,8 +1004,8 @@  static struct i2c_driver ov02a10_i2c_driver = {
 		.pm = &ov02a10_pm_ops,
 		.of_match_table = ov02a10_of_match,
 	},
-	.probe_new	= &ov02a10_probe,
-	.remove		= &ov02a10_remove,
+	.probe_new	= ov02a10_probe,
+	.remove		= ov02a10_remove,
 };
 module_i2c_driver(ov02a10_i2c_driver);
 
diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c
index b6e010ea3249..4b9f4f3a0194 100644
--- a/drivers/media/i2c/ov2685.c
+++ b/drivers/media/i2c/ov2685.c
@@ -832,8 +832,8 @@  static struct i2c_driver ov2685_i2c_driver = {
 		.pm = &ov2685_pm_ops,
 		.of_match_table = of_match_ptr(ov2685_of_match),
 	},
-	.probe		= &ov2685_probe,
-	.remove		= &ov2685_remove,
+	.probe		= ov2685_probe,
+	.remove		= ov2685_remove,
 };
 
 module_i2c_driver(ov2685_i2c_driver);
diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
index 910309783885..59da66f4f810 100644
--- a/drivers/media/i2c/ov5695.c
+++ b/drivers/media/i2c/ov5695.c
@@ -1395,8 +1395,8 @@  static struct i2c_driver ov5695_i2c_driver = {
 		.pm = &ov5695_pm_ops,
 		.of_match_table = of_match_ptr(ov5695_of_match),
 	},
-	.probe		= &ov5695_probe,
-	.remove		= &ov5695_remove,
+	.probe		= ov5695_probe,
+	.remove		= ov5695_remove,
 };
 
 module_i2c_driver(ov5695_i2c_driver);