From nobody Wed Dec 17 09:16:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AC60C32772 for ; Tue, 23 Aug 2022 11:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238339AbiHWLDV (ORCPT ); Tue, 23 Aug 2022 07:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356773AbiHWK7A (ORCPT ); Tue, 23 Aug 2022 06:59:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6823ADCFE; Tue, 23 Aug 2022 02:13:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2AE660F54; Tue, 23 Aug 2022 09:13:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB036C433D6; Tue, 23 Aug 2022 09:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246029; bh=zCjPwheLub6dsDGmASzjdfqqFdiCv1VVXqIVLu32/tE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dP9EnbgQMl1cZOQEiIgZCqEmzH3P9etlcG7qAemoNBlnT7lx1aQemYEQy1ZCaJ/p5 zpjPW9HV53J3Dh+gymd3L3cdFB4SX3xAo3QqIgWEv054hQo4BTMGHeQTuDYC2vNId8 EgU4PxNHXFnKpmH8s2CFtIorTv6STINB+m+Kx0W4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Baolin Wang , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 266/287] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Date: Tue, 23 Aug 2022 10:27:15 +0200 Message-Id: <20220823080110.305326297@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 1e42f82cbec7b2cc4873751e7791e6611901c5fc ] 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=C3=B6nig Reviewed-by: Baolin Wang Link: https://lore.kernel.org/r/20220721204054.323602-1-u.kleine-koenig@pen= gutronix.de Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- 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 0fadf6a08494..4ec9a924a338 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -987,11 +987,8 @@ static int sprd_dma_remove(struct platform_device *pde= v) { struct sprd_dma_dev *sdev =3D platform_get_drvdata(pdev); struct sprd_dma_chn *c, *cn; - int ret; =20 - ret =3D pm_runtime_get_sync(&pdev->dev); - if (ret < 0) - return ret; + pm_runtime_get_sync(&pdev->dev); =20 /* explicitly free the irq */ if (sdev->irq > 0) --=20 2.35.1