Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3409218rwa; Tue, 23 Aug 2022 04:25:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR7yJv6vnknkCtU5MMDa1LDhsns0/k1PdYU6bAxguwyMEt7xYYefxD3R/Uu4ZHOyu5wl5l/n X-Received: by 2002:a63:698a:0:b0:41c:8dfb:29cb with SMTP id e132-20020a63698a000000b0041c8dfb29cbmr20150517pgc.170.1661253904703; Tue, 23 Aug 2022 04:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253904; cv=none; d=google.com; s=arc-20160816; b=ktiugURjJYXwi25z/j9P87umVgsU7rCBCtJD6wyPgWQmx74VyZW98mZQyTExz7kB6E ZGKORu+9+qCeA0QZf7lIPogpMIq59BSc36RkUTMu1ujPLTCdXGkuJfuyg/SetfCGv3MD ghx5KUvt4c455xVrxl12j22JMVoxhiErqEEXSnUctBdicphPi589+2qVWDGtx6E8CmY8 8EA9L4jsvSYdmOdRuMPHKV5k4/4gjjgo4xefOr8tIYC9P3DBmprRFtIYQ6DeeDG9dCUM uIK5hmozRynA1uYHinYZ+K54RiTLNjHl1QLx98WeH5VLqPzvawa81UG8EbJdUGgRVdwz SwDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xCGr/Mn2Vbr9oAM99HAaOR9hZfdAdGA9HTuypbHqfhk=; b=DWdadmaKiSrCjrjefVxb7YyOOoqlnoJEZjt4lGTSkTtOEib2DinYFv65/TEZSDkkMq 33zuIB5LVg5y8fUxqFeC/hgdstWkqg/KnPFKBVy1kw+bPKukEysPrMwjNvg59RBQe4C+ 9QnnHKf7YnePWT5VRl44yWPqvvs97XeniT2ysUX4zSAwzrsmSNtUO2J7B/MaPIYt6WcS m4+07+pDVo6xUH+DDutJ6a6JOYv2LY4SOzMpg9as0sm8v/NjCR6olP9/d6EG4DpgmMeo UFrtcoiub8/MLKdg2nhPgTgnQZRE6YCTK2rYtLdgeLzBWRDILSVjQ9OUcivmaqKpj1My 5k7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yR4tfwHP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020a654386000000b0042971e401e3si16178042pgp.307.2022.08.23.04.24.53; Tue, 23 Aug 2022 04:25:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yR4tfwHP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354157AbiHWKZK (ORCPT + 99 others); Tue, 23 Aug 2022 06:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353580AbiHWKLk (ORCPT ); Tue, 23 Aug 2022 06:11:40 -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 A815C634F; Tue, 23 Aug 2022 01:57:28 -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 45E0461524; Tue, 23 Aug 2022 08:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC24C433D6; Tue, 23 Aug 2022 08:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245047; bh=t1roUgaSTodrFE5Q67YXj8K4EuRG/7oWKG6ZxMhzEgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yR4tfwHPFbDJf3XrvQuQ+o4Jx4J6Jrtp/94399RFG/pxZCQzct46TMHVpUsHhYPrM uc+6vNVn2HvK0qITVfJE8722v8CqPqaBk9sEWfzNJbJvRSfhQPLERPdX/QNcR9j/Sh yr52bepTshpB9KtBzJWpDXRgA75c0nylN6nRkNIo= 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 5.15 198/244] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Date: Tue, 23 Aug 2022 10:25:57 +0200 Message-Id: <20220823080106.062173980@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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