All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: pxa_camera: disable and unprepare the clock source on error
@ 2017-12-06 16:38 Flavio Ceolin
  2017-12-11 16:51 ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Flavio Ceolin @ 2017-12-06 16:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Flavio Ceolin, Mauro Carvalho Chehab, Hans Verkuil, Petr Cvek,
	Sakari Ailus, Niklas Söderlund, Laurent Pinchart,
	Julia Lawall, Arnd Bergmann,
	open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

pxa_camera_probe() was not calling pxa_camera_deactivate(),
responsible to call clk_disable_unprepare(), on the failure path. This
was leading to unbalancing source clock.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
---
 drivers/media/platform/pxa_camera.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
index 9d3f0cb..7877037 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -2489,7 +2489,7 @@ static int pxa_camera_probe(struct platform_device *pdev)
 	dev_set_drvdata(&pdev->dev, pcdev);
 	err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
 	if (err)
-		goto exit_free_dma;
+		goto exit_deactivate;
 
 	pcdev->asds[0] = &pcdev->asd;
 	pcdev->notifier.subdevs = pcdev->asds;
@@ -2525,6 +2525,8 @@ static int pxa_camera_probe(struct platform_device *pdev)
 	v4l2_clk_unregister(pcdev->mclk_clk);
 exit_free_v4l2dev:
 	v4l2_device_unregister(&pcdev->v4l2_dev);
+exit_deactivate:
+	pxa_camera_deactivate(pcdev);
 exit_free_dma:
 	dma_release_channel(pcdev->dma_chans[2]);
 exit_free_dma_u:
-- 
2.9.5

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

* Re: [PATCH] media: pxa_camera: disable and unprepare the clock source on error
  2017-12-06 16:38 [PATCH] media: pxa_camera: disable and unprepare the clock source on error Flavio Ceolin
@ 2017-12-11 16:51 ` Laurent Pinchart
  2017-12-11 21:05   ` Flavio Ceolin
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2017-12-11 16:51 UTC (permalink / raw)
  To: Flavio Ceolin
  Cc: linux-kernel, Mauro Carvalho Chehab, Hans Verkuil, Petr Cvek,
	Sakari Ailus, Niklas Söderlund, Julia Lawall, Arnd Bergmann,
	open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

Hi Flavio,

Thank you for the patch.

On Wednesday, 6 December 2017 18:38:50 EET Flavio Ceolin wrote:
> pxa_camera_probe() was not calling pxa_camera_deactivate(),
> responsible to call clk_disable_unprepare(), on the failure path. This
> was leading to unbalancing source clock.
> 
> Found by Linux Driver Verification project (linuxtesting.org).

Any chance I could sign you up for more work on this driver ? :-)

> Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I expect Hans Verkuil to pick up the patch.

> ---
>  drivers/media/platform/pxa_camera.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/pxa_camera.c
> b/drivers/media/platform/pxa_camera.c index 9d3f0cb..7877037 100644
> --- a/drivers/media/platform/pxa_camera.c
> +++ b/drivers/media/platform/pxa_camera.c
> @@ -2489,7 +2489,7 @@ static int pxa_camera_probe(struct platform_device
> *pdev) dev_set_drvdata(&pdev->dev, pcdev);
>  	err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
>  	if (err)
> -		goto exit_free_dma;
> +		goto exit_deactivate;
> 
>  	pcdev->asds[0] = &pcdev->asd;
>  	pcdev->notifier.subdevs = pcdev->asds;
> @@ -2525,6 +2525,8 @@ static int pxa_camera_probe(struct platform_device
> *pdev) v4l2_clk_unregister(pcdev->mclk_clk);
>  exit_free_v4l2dev:
>  	v4l2_device_unregister(&pcdev->v4l2_dev);
> +exit_deactivate:
> +	pxa_camera_deactivate(pcdev);
>  exit_free_dma:
>  	dma_release_channel(pcdev->dma_chans[2]);
>  exit_free_dma_u:

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] media: pxa_camera: disable and unprepare the clock source on error
  2017-12-11 16:51 ` Laurent Pinchart
@ 2017-12-11 21:05   ` Flavio Ceolin
  2017-12-11 21:43     ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Flavio Ceolin @ 2017-12-11 21:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-kernel, Mauro Carvalho Chehab, Hans Verkuil, Petr Cvek,
	Sakari Ailus, Niklas Söderlund, Julia Lawall, Arnd Bergmann,
	open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

Hi Laurent,

> Hi Flavio,
>
> Thank you for the patch.
>
> On Wednesday, 6 December 2017 18:38:50 EET Flavio Ceolin wrote:
>> pxa_camera_probe() was not calling pxa_camera_deactivate(),
>> responsible to call clk_disable_unprepare(), on the failure path. This
>> was leading to unbalancing source clock.
>> 
>> Found by Linux Driver Verification project (linuxtesting.org).
>
> Any chance I could sign you up for more work on this driver ? :-)

Definetely, this would be great :)

>
>> Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I expect Hans Verkuil to pick up the patch.
>
>> ---
>>  drivers/media/platform/pxa_camera.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/media/platform/pxa_camera.c
>> b/drivers/media/platform/pxa_camera.c index 9d3f0cb..7877037 100644
>> --- a/drivers/media/platform/pxa_camera.c
>> +++ b/drivers/media/platform/pxa_camera.c
>> @@ -2489,7 +2489,7 @@ static int pxa_camera_probe(struct platform_device
>> *pdev) dev_set_drvdata(&pdev->dev, pcdev);
>>  	err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
>>  	if (err)
>> -		goto exit_free_dma;
>> +		goto exit_deactivate;
>> 
>>  	pcdev->asds[0] = &pcdev->asd;
>>  	pcdev->notifier.subdevs = pcdev->asds;
>> @@ -2525,6 +2525,8 @@ static int pxa_camera_probe(struct platform_device
>> *pdev) v4l2_clk_unregister(pcdev->mclk_clk);
>>  exit_free_v4l2dev:
>>  	v4l2_device_unregister(&pcdev->v4l2_dev);
>> +exit_deactivate:
>> +	pxa_camera_deactivate(pcdev);
>>  exit_free_dma:
>>  	dma_release_channel(pcdev->dma_chans[2]);
>>  exit_free_dma_u:
>
> -- 
> Regards,
>
> Laurent Pinchart

Regards,
Flavio Ceolin

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

* Re: [PATCH] media: pxa_camera: disable and unprepare the clock source on error
  2017-12-11 21:05   ` Flavio Ceolin
@ 2017-12-11 21:43     ` Laurent Pinchart
  2017-12-11 23:36       ` Flavio Ceolin
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2017-12-11 21:43 UTC (permalink / raw)
  To: Flavio Ceolin
  Cc: linux-kernel, Mauro Carvalho Chehab, Hans Verkuil, Petr Cvek,
	Sakari Ailus, Niklas Söderlund, Julia Lawall, Arnd Bergmann,
	open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

Hi Flavio,

On Monday, 11 December 2017 23:05:46 EET Flavio Ceolin wrote:
> > On Wednesday, 6 December 2017 18:38:50 EET Flavio Ceolin wrote:
> >> pxa_camera_probe() was not calling pxa_camera_deactivate(),
> >> responsible to call clk_disable_unprepare(), on the failure path. This
> >> was leading to unbalancing source clock.
> >> 
> >> Found by Linux Driver Verification project (linuxtesting.org).
> > 
> > Any chance I could sign you up for more work on this driver ? :-)
> 
> Definetely, this would be great :)

Actually it looks like the work I thought was needed has already been 
performed. The pxa-camera driver used to make use of the soc-camera framework, 
which we are trying to remove, and occurrences of soc_camera in the code gave 
me the wrong idea that the driver was still based on that framework. It seems 
this isn't the case. Thank you for making me happy :-)

> >> Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
> > 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > I expect Hans Verkuil to pick up the patch.
> > 
> >> ---
> >> 
> >>  drivers/media/platform/pxa_camera.c | 4 +++-
> >>  1 file changed, 3 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/media/platform/pxa_camera.c
> >> b/drivers/media/platform/pxa_camera.c index 9d3f0cb..7877037 100644
> >> --- a/drivers/media/platform/pxa_camera.c
> >> +++ b/drivers/media/platform/pxa_camera.c
> >> @@ -2489,7 +2489,7 @@ static int pxa_camera_probe(struct platform_device
> >> *pdev)
> >> 	dev_set_drvdata(&pdev->dev, pcdev);
> >>  	err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
> >>  	if (err)
> >> -		goto exit_free_dma;
> >> +		goto exit_deactivate;
> >> 
> >>  	pcdev->asds[0] = &pcdev->asd;
> >>  	pcdev->notifier.subdevs = pcdev->asds;
> >> @@ -2525,6 +2525,8 @@ static int pxa_camera_probe(struct platform_device
> >> *pdev)
> >> 	v4l2_clk_unregister(pcdev->mclk_clk);
> >>  exit_free_v4l2dev:
> >>  	v4l2_device_unregister(&pcdev->v4l2_dev);
> >> +exit_deactivate:
> >> +	pxa_camera_deactivate(pcdev);
> >>  exit_free_dma:
> >>  	dma_release_channel(pcdev->dma_chans[2]);
> >>  exit_free_dma_u:

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] media: pxa_camera: disable and unprepare the clock source on error
  2017-12-11 21:43     ` Laurent Pinchart
@ 2017-12-11 23:36       ` Flavio Ceolin
  0 siblings, 0 replies; 5+ messages in thread
From: Flavio Ceolin @ 2017-12-11 23:36 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-kernel, Mauro Carvalho Chehab, Hans Verkuil, Petr Cvek,
	Sakari Ailus, Niklas Söderlund, Julia Lawall, Arnd Bergmann,
	open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:

> Hi Flavio,
>
> On Monday, 11 December 2017 23:05:46 EET Flavio Ceolin wrote:
>> > On Wednesday, 6 December 2017 18:38:50 EET Flavio Ceolin wrote:
>> >> pxa_camera_probe() was not calling pxa_camera_deactivate(),
>> >> responsible to call clk_disable_unprepare(), on the failure path. This
>> >> was leading to unbalancing source clock.
>> >> 
>> >> Found by Linux Driver Verification project (linuxtesting.org).
>> > 
>> > Any chance I could sign you up for more work on this driver ? :-)
>> 
>> Definetely, this would be great :)
>
> Actually it looks like the work I thought was needed has already been 
> performed. The pxa-camera driver used to make use of the soc-camera framework, 
> which we are trying to remove, and occurrences of soc_camera in the code gave 
> me the wrong idea that the driver was still based on that framework. It seems 
> this isn't the case. Thank you for making me happy :-)

I'm glad to hear it :)

>
>> >> Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
>> > 
>> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> > 
>> > I expect Hans Verkuil to pick up the patch.
>> > 
>> >> ---
>> >> 
>> >>  drivers/media/platform/pxa_camera.c | 4 +++-
>> >>  1 file changed, 3 insertions(+), 1 deletion(-)
>> >> 
>> >> diff --git a/drivers/media/platform/pxa_camera.c
>> >> b/drivers/media/platform/pxa_camera.c index 9d3f0cb..7877037 100644
>> >> --- a/drivers/media/platform/pxa_camera.c
>> >> +++ b/drivers/media/platform/pxa_camera.c
>> >> @@ -2489,7 +2489,7 @@ static int pxa_camera_probe(struct platform_device
>> >> *pdev)
>> >> 	dev_set_drvdata(&pdev->dev, pcdev);
>> >>  	err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
>> >>  	if (err)
>> >> -		goto exit_free_dma;
>> >> +		goto exit_deactivate;
>> >> 
>> >>  	pcdev->asds[0] = &pcdev->asd;
>> >>  	pcdev->notifier.subdevs = pcdev->asds;
>> >> @@ -2525,6 +2525,8 @@ static int pxa_camera_probe(struct platform_device
>> >> *pdev)
>> >> 	v4l2_clk_unregister(pcdev->mclk_clk);
>> >>  exit_free_v4l2dev:
>> >>  	v4l2_device_unregister(&pcdev->v4l2_dev);
>> >> +exit_deactivate:
>> >> +	pxa_camera_deactivate(pcdev);
>> >>  exit_free_dma:
>> >>  	dma_release_channel(pcdev->dma_chans[2]);
>> >>  exit_free_dma_u:
>
> -- 
> Regards,
>
> Laurent Pinchart

Regards,
Flavio Ceolin

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

end of thread, other threads:[~2017-12-11 23:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 16:38 [PATCH] media: pxa_camera: disable and unprepare the clock source on error Flavio Ceolin
2017-12-11 16:51 ` Laurent Pinchart
2017-12-11 21:05   ` Flavio Ceolin
2017-12-11 21:43     ` Laurent Pinchart
2017-12-11 23:36       ` Flavio Ceolin

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.