Skip to content

Commit 8d72880

Browse files
dinghaoliubroonie
authored andcommitted
spi: spi-fsl-lpspi: Fix runtime PM imbalance on error
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent c373643 commit 8d72880

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
940940
ret = pm_runtime_get_sync(fsl_lpspi->dev);
941941
if (ret < 0) {
942942
dev_err(fsl_lpspi->dev, "failed to enable clock\n");
943-
goto out_controller_put;
943+
goto out_pm_get;
944944
}
945945

946946
temp = readl(fsl_lpspi->base + IMX7ULP_PARAM);
@@ -949,13 +949,15 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
949949

950950
ret = fsl_lpspi_dma_init(&pdev->dev, fsl_lpspi, controller);
951951
if (ret == -EPROBE_DEFER)
952-
goto out_controller_put;
952+
goto out_pm_get;
953953

954954
if (ret < 0)
955955
dev_err(&pdev->dev, "dma setup error %d, use pio\n", ret);
956956

957957
return 0;
958958

959+
out_pm_get:
960+
pm_runtime_put_noidle(fsl_lpspi->dev);
959961
out_controller_put:
960962
spi_controller_put(controller);
961963

0 commit comments

Comments
 (0)