From mboxrd@z Thu Jan 1 00:00:00 1970 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 ED98EC25B06 for ; Sun, 14 Aug 2022 15:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241592AbiHNPrd (ORCPT ); Sun, 14 Aug 2022 11:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241461AbiHNPpD (ORCPT ); Sun, 14 Aug 2022 11:45:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD42E2494B; Sun, 14 Aug 2022 08:34:10 -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 9091C60CF1; Sun, 14 Aug 2022 15:34:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06712C433D7; Sun, 14 Aug 2022 15:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660491249; bh=t1roUgaSTodrFE5Q67YXj8K4EuRG/7oWKG6ZxMhzEgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W3GhR4uqLnh0tbC4JCnYlL8maN1sLXZ93UAEpaSZ8nhELQc74o2y3rlErI48o1VWu EH9VzGZosDoUGjnp3IUXc8WMbJYy4hRR6Iw4gzdqButMGqcMVbaPEr2HIAHRu5e7qu 9lF2OK7ygZkiEB1PCwFo4Gdn6YbhAh+rAJWABFi+iY3Ezi+kTEiAVRjPKLqN016V00 fuzWJfDRAL4HCL2mILdVGSkTDY0YLCdYkZIMfOe2Hfy5VBccW6/6zF7ztE+PsjxRT8 FC/r9z/oDziCyB/fDpk3O8/nqp49TICkCfjbpI710MESkDYCwfMJFeHyFLWxh8Bp6+ sbHiIeH/OJd3g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Baolin Wang , Vinod Koul , Sasha Levin , orsonzhai@gmail.com, zhang.lyra@gmail.com, dmaengine@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 37/46] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Date: Sun, 14 Aug 2022 11:32:38 -0400 Message-Id: <20220814153247.2378312-37-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814153247.2378312-1-sashal@kernel.org> References: <20220814153247.2378312-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Uwe Kleine-König [ 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önig Reviewed-by: Baolin Wang Link: https://lore.kernel.org/r/20220721204054.323602-1-u.kleine-koenig@pengutronix.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 4357d2395e6b..60115d8d4083 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1236,11 +1236,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) -- 2.35.1