2022-07-22 03:12:14

by Lin Ma

[permalink] [raw]
Subject: [PATCH v0] media: i2c: fix the erroneous pointer initializer

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 <[email protected]>
---
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(-)

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);
--
2.36.1


2022-07-22 03:19:28

by Lin Ma

[permalink] [raw]
Subject: Re: [PATCH v0] media: i2c: fix the erroneous pointer initializer

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 <[email protected]>

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

2022-07-23 09:20:37

by Sakari Ailus

[permalink] [raw]
Subject: Re: [PATCH v0] media: i2c: fix the erroneous pointer initializer

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 <[email protected]>
>
> 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.

--
Regards,

Sakari Ailus