Re: [PATCH] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 22, 2022 at 4:41 AM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxxxx>

It makes sense to me. Thanks.
Reviewed-by: Baolin Wang <baolin.wang7@xxxxxxxxx>

> ---
>  drivers/dma/sprd-dma.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 2138b80435ab..474d3ba8ec9f 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -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)
>
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
> --
> 2.36.1
>


-- 
Baolin Wang




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux