dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 21 Jul 2022 20:40:54 +0000 (22:40 +0200)
committerVinod Koul <vkoul@kernel.org>
Tue, 26 Jul 2022 12:50:49 +0000 (18:20 +0530)
It's not allowed to quit remove early without cleaning up completely.
Otherwise this results in resource leaks that probably yield graver
problems later. Here for example some tasklets might survive the lifetime
of the sprd-dma device and access sdev which is freed after .remove()
returns.

As none of the device freeing requires an active device, just ignore the
return value of pm_runtime_get_sync().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Link: https://lore.kernel.org/r/20220721204054.323602-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sprd-dma.c

index 2138b80..474d3ba 100644 (file)
@@ -1237,11 +1237,8 @@ static int sprd_dma_remove(struct platform_device *pdev)
 {
        struct sprd_dma_dev *sdev = platform_get_drvdata(pdev);
        struct sprd_dma_chn *c, *cn;
-       int ret;
 
-       ret = pm_runtime_get_sync(&pdev->dev);
-       if (ret < 0)
-               return ret;
+       pm_runtime_get_sync(&pdev->dev);
 
        /* explicitly free the irq */
        if (sdev->irq > 0)