media: pxa_camera: disable and unprepare the clock source on error
authorFlavio Ceolin <flavio.ceolin@intel.com>
Wed, 6 Dec 2017 16:38:50 +0000 (11:38 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 18 Dec 2017 19:57:45 +0000 (14:57 -0500)
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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/pxa_camera.c

index 305cf1c..d684073 100644 (file)
@@ -2491,7 +2491,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;
@@ -2527,6 +2527,8 @@ exit_free_clk:
        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: