diff mbox series

[v3] media: atmel: atmel-isc: Fix PM disable depth imbalance in atmel_isc_probe

Message ID 20220307081638.19733-1-linmq006@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v3] media: atmel: atmel-isc: Fix PM disable depth imbalance in atmel_isc_probe | expand

Commit Message

Miaoqian Lin March 7, 2022, 8:16 a.m. UTC
The pm_runtime_enable will decrease power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().

Fixes: 0a0e265 ("media: atmel: atmel-isc: split driver into driver base and isc")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- remove unused label.
changes in v3:
- add disable_pm label and update related 'goto'
- update commit message
---
 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Eugen Hristev May 9, 2022, 7:13 p.m. UTC | #1
On 3/7/22 10:16 AM, Miaoqian Lin wrote:
> The pm_runtime_enable will decrease power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> 
> Fixes: 0a0e265 ("media: atmel: atmel-isc: split driver into driver base and isc")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>

> ---
> changes in v2:
> - remove unused label.
> changes in v3:
> - add disable_pm label and update related 'goto'
> - update commit message
> ---
>   drivers/media/platform/atmel/atmel-sama5d2-isc.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
> index 1b2063cce0f7..949035cdb846 100644
> --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
> +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
> @@ -538,7 +538,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
>          ret = clk_prepare_enable(isc->ispck);
>          if (ret) {
>                  dev_err(dev, "failed to enable ispck: %d\n", ret);
> -               goto cleanup_subdev;
> +               goto disable_pm;
>          }
> 
>          /* ispck should be greater or equal to hclock */
> @@ -556,6 +556,9 @@ static int atmel_isc_probe(struct platform_device *pdev)
>   unprepare_clk:
>          clk_disable_unprepare(isc->ispck);
> 
> +disable_pm:
> +       pm_runtime_disable(dev);
> +
>   cleanup_subdev:
>          isc_subdev_cleanup(isc);
> 
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
index 1b2063cce0f7..949035cdb846 100644
--- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
+++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
@@ -538,7 +538,7 @@  static int atmel_isc_probe(struct platform_device *pdev)
 	ret = clk_prepare_enable(isc->ispck);
 	if (ret) {
 		dev_err(dev, "failed to enable ispck: %d\n", ret);
-		goto cleanup_subdev;
+		goto disable_pm;
 	}
 
 	/* ispck should be greater or equal to hclock */
@@ -556,6 +556,9 @@  static int atmel_isc_probe(struct platform_device *pdev)
 unprepare_clk:
 	clk_disable_unprepare(isc->ispck);
 
+disable_pm:
+	pm_runtime_disable(dev);
+
 cleanup_subdev:
 	isc_subdev_cleanup(isc);