2022-04-22 19:04:58

by Dongliang Mu

[permalink] [raw]
Subject: [PATCH] media: ov7670: remove ov7670_power_off from ov7670_remove

From: Dongliang Mu <[email protected]>

In ov7670_probe, it always invokes ov7670_power_off() no matter
the execution is successful or failed. So we cannot invoke it
agiain in ov7670_remove().

Fix this by removing ov7670_power_off from ov7670_remove.

Fixes: 030f9f682e66 ("media: ov7670: control clock along with power")
Signed-off-by: Dongliang Mu <[email protected]>
---
drivers/media/i2c/ov7670.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 196746423116..1be2c0e5bdc1 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -2017,7 +2017,6 @@ static int ov7670_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(sd);
v4l2_ctrl_handler_free(&info->hdl);
media_entity_cleanup(&info->sd.entity);
- ov7670_power_off(sd);
return 0;
}

--
2.25.1


2022-04-25 12:24:17

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] media: ov7670: remove ov7670_power_off from ov7670_remove

Hi Dongliang,

Thank you for the patch.

On Fri, Apr 22, 2022 at 04:54:05PM +0800, Dongliang Mu wrote:
> From: Dongliang Mu <[email protected]>
>
> In ov7670_probe, it always invokes ov7670_power_off() no matter
> the execution is successful or failed. So we cannot invoke it
> agiain in ov7670_remove().
>
> Fix this by removing ov7670_power_off from ov7670_remove.
>
> Fixes: 030f9f682e66 ("media: ov7670: control clock along with power")

ov7670_power_off() is a no-op if power is already off. What does this
fix ?

> Signed-off-by: Dongliang Mu <[email protected]>
> ---
> drivers/media/i2c/ov7670.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> index 196746423116..1be2c0e5bdc1 100644
> --- a/drivers/media/i2c/ov7670.c
> +++ b/drivers/media/i2c/ov7670.c
> @@ -2017,7 +2017,6 @@ static int ov7670_remove(struct i2c_client *client)
> v4l2_async_unregister_subdev(sd);
> v4l2_ctrl_handler_free(&info->hdl);
> media_entity_cleanup(&info->sd.entity);
> - ov7670_power_off(sd);
> return 0;
> }
>

--
Regards,

Laurent Pinchart

2022-04-26 07:34:05

by Dongliang Mu

[permalink] [raw]
Subject: Re: [PATCH] media: ov7670: remove ov7670_power_off from ov7670_remove

On Mon, Apr 25, 2022 at 12:40 AM Laurent Pinchart
<[email protected]> wrote:
>
> Hi Dongliang,
>
> Thank you for the patch.
>
> On Fri, Apr 22, 2022 at 04:54:05PM +0800, Dongliang Mu wrote:
> > From: Dongliang Mu <[email protected]>
> >
> > In ov7670_probe, it always invokes ov7670_power_off() no matter
> > the execution is successful or failed. So we cannot invoke it
> > agiain in ov7670_remove().
> >
> > Fix this by removing ov7670_power_off from ov7670_remove.
> >
> > Fixes: 030f9f682e66 ("media: ov7670: control clock along with power")
>
> ov7670_power_off() is a no-op if power is already off. What does this
> fix ?

Yes, this is true. I just thought this is redundant, so I remove
ov7670_power_off from ov7670_remove

If current code is fine, please ignore this patch.

>
> > Signed-off-by: Dongliang Mu <[email protected]>
> > ---
> > drivers/media/i2c/ov7670.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> > index 196746423116..1be2c0e5bdc1 100644
> > --- a/drivers/media/i2c/ov7670.c
> > +++ b/drivers/media/i2c/ov7670.c
> > @@ -2017,7 +2017,6 @@ static int ov7670_remove(struct i2c_client *client)
> > v4l2_async_unregister_subdev(sd);
> > v4l2_ctrl_handler_free(&info->hdl);
> > media_entity_cleanup(&info->sd.entity);
> > - ov7670_power_off(sd);
> > return 0;
> > }
> >
>
> --
> Regards,
>
> Laurent Pinchart