All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on()
@ 2022-06-17  1:39 Yang Yingliang
  2022-06-17 10:20 ` Andy Shevchenko
  2022-06-17 22:02 ` Daniel Scally
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Yingliang @ 2022-06-17  1:39 UTC (permalink / raw)
  To: linux-kernel, linux-media
  Cc: mchehab, djrscally, andriy.shevchenko, sakari.ailus

Add the missing 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>
---
 drivers/media/i2c/ov7251.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 0e7be15bc20a..40c207d1d7af 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -934,6 +934,7 @@ 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");
+		clk_disable_unprepare(ov7251->xclk);
 		ov7251_regulators_disable(ov7251);
 		return ret;
 	}
-- 
2.25.1


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

* Re: [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on()
  2022-06-17  1:39 [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on() Yang Yingliang
@ 2022-06-17 10:20 ` Andy Shevchenko
  2022-06-20  8:48   ` Yang Yingliang
  2022-06-17 22:02 ` Daniel Scally
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-06-17 10:20 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-media, mchehab, djrscally, sakari.ailus

On Fri, Jun 17, 2022 at 09:39:43AM +0800, Yang Yingliang wrote:
> Add the missing clk_disable_unprepare() before return
> from ov7251_set_power_on() in the error handling case.

...

>  	if (ret < 0) {
>  		dev_err(ov7251->dev, "error during global init\n");
> +		clk_disable_unprepare(ov7251->xclk);
>  		ov7251_regulators_disable(ov7251);

Logically it should go here. Please, read a code above this check.

>  		return ret;
>  	}

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on()
  2022-06-17  1:39 [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on() Yang Yingliang
  2022-06-17 10:20 ` Andy Shevchenko
@ 2022-06-17 22:02 ` Daniel Scally
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Scally @ 2022-06-17 22:02 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, linux-media
  Cc: mchehab, andriy.shevchenko, sakari.ailus

Hello

On 17/06/2022 02:39, Yang Yingliang wrote:
> Add the missing 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>


Thanks for spotting this - with Andy's comment addressed:


Reviewed-by: Daniel Scally <djrscally@gmail.com>

> ---
>  drivers/media/i2c/ov7251.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
> index 0e7be15bc20a..40c207d1d7af 100644
> --- a/drivers/media/i2c/ov7251.c
> +++ b/drivers/media/i2c/ov7251.c
> @@ -934,6 +934,7 @@ 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");
> +		clk_disable_unprepare(ov7251->xclk);
>  		ov7251_regulators_disable(ov7251);
>  		return ret;
>  	}

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

* Re: [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on()
  2022-06-17 10:20 ` Andy Shevchenko
@ 2022-06-20  8:48   ` Yang Yingliang
  2022-06-20  9:52     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Yang Yingliang @ 2022-06-20  8:48 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-kernel, linux-media, mchehab, djrscally, sakari.ailus

Hi,

On 2022/6/17 18:20, Andy Shevchenko wrote:
> On Fri, Jun 17, 2022 at 09:39:43AM +0800, Yang Yingliang wrote:
>> Add the missing clk_disable_unprepare() before return
>> from ov7251_set_power_on() in the error handling case.
> ...
>
>>   	if (ret < 0) {
>>   		dev_err(ov7251->dev, "error during global init\n");
>> +		clk_disable_unprepare(ov7251->xclk);
>>   		ov7251_regulators_disable(ov7251);
> Logically it should go here. Please, read a code above this check.
Do you mean print the error code on error path ?

Thanks,
Yang
>
>>   		return ret;
>>   	}

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

* Re: [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on()
  2022-06-20  8:48   ` Yang Yingliang
@ 2022-06-20  9:52     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-06-20  9:52 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-media, mchehab, djrscally, sakari.ailus

On Mon, Jun 20, 2022 at 04:48:46PM +0800, Yang Yingliang wrote:
> On 2022/6/17 18:20, Andy Shevchenko wrote:
> > On Fri, Jun 17, 2022 at 09:39:43AM +0800, Yang Yingliang wrote:

...

> > >   	if (ret < 0) {
> > >   		dev_err(ov7251->dev, "error during global init\n");
> > > +		clk_disable_unprepare(ov7251->xclk);
> > >   		ov7251_regulators_disable(ov7251);
> > Logically it should go here. Please, read a code above this check.
> Do you mean print the error code on error path ?

The new code, you added, should be in correct order (reversed in comparison to
resource allocation / registration).

> > >   		return ret;
> > >   	}

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2022-06-20  9:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17  1:39 [PATCH] media: ov7251: add missing clk_disable_unprepare() on error in ov7251_set_power_on() Yang Yingliang
2022-06-17 10:20 ` Andy Shevchenko
2022-06-20  8:48   ` Yang Yingliang
2022-06-20  9:52     ` Andy Shevchenko
2022-06-17 22:02 ` Daniel Scally

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.