linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2] media: ov7251: add missing disable functions on error in ov7251_set_power_on()
@ 2022-06-22  4:42 Yang Yingliang
  2022-06-22 11:16 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-06-22  4:42 UTC (permalink / raw)
  To: linux-kernel, linux-media
  Cc: mchehab, djrscally, andriy.shevchenko, sakari.ailus

Add the missing gpiod_set_value_cansleep() and clk_disable_unprepare()
before return from ov7251_set_power_on() in the error handling case.

Fixes: 9e1d3012cc10 ("media: i2c: Remove .s_power() from ov7251")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
  - add gpiod_set_value_cansleep()
  - also change the patch title and commit message
---
 drivers/media/i2c/ov7251.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 0e7be15bc20a..ad9689820ecc 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -934,6 +934,8 @@ static int ov7251_set_power_on(struct device *dev)
 					ARRAY_SIZE(ov7251_global_init_setting));
 	if (ret < 0) {
 		dev_err(ov7251->dev, "error during global init\n");
+		gpiod_set_value_cansleep(ov7251->enable_gpio, 0);
+		clk_disable_unprepare(ov7251->xclk);
 		ov7251_regulators_disable(ov7251);
 		return ret;
 	}
-- 
2.25.1


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

* Re: [PATCH -next v2] media: ov7251: add missing disable functions on error in ov7251_set_power_on()
  2022-06-22  4:42 [PATCH -next v2] media: ov7251: add missing disable functions on error in ov7251_set_power_on() Yang Yingliang
@ 2022-06-22 11:16 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2022-06-22 11:16 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-media, mchehab, djrscally, sakari.ailus

On Wed, Jun 22, 2022 at 12:42:43PM +0800, Yang Yingliang wrote:
> Add the missing gpiod_set_value_cansleep() and clk_disable_unprepare()
> before return from ov7251_set_power_on() in the error handling case.

This makes sense to me from code flow perspective.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Fixes: 9e1d3012cc10 ("media: i2c: Remove .s_power() from ov7251")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v2:
>   - add gpiod_set_value_cansleep()
>   - also change the patch title and commit message
> ---
>  drivers/media/i2c/ov7251.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
> index 0e7be15bc20a..ad9689820ecc 100644
> --- a/drivers/media/i2c/ov7251.c
> +++ b/drivers/media/i2c/ov7251.c
> @@ -934,6 +934,8 @@ static int ov7251_set_power_on(struct device *dev)
>  					ARRAY_SIZE(ov7251_global_init_setting));
>  	if (ret < 0) {
>  		dev_err(ov7251->dev, "error during global init\n");
> +		gpiod_set_value_cansleep(ov7251->enable_gpio, 0);
> +		clk_disable_unprepare(ov7251->xclk);
>  		ov7251_regulators_disable(ov7251);
>  		return ret;
>  	}
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2022-06-22 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  4:42 [PATCH -next v2] media: ov7251: add missing disable functions on error in ov7251_set_power_on() Yang Yingliang
2022-06-22 11:16 ` Andy Shevchenko

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