Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3403217rwa; Tue, 23 Aug 2022 04:19:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7YFDRiq2qH7oQVTGi0H6d3Q3RxNidmYKI0+NXbJpBZiI+7xQflyuybG8wZa6w5VGna5fJT X-Received: by 2002:a05:6a00:13a3:b0:537:6af:d2ae with SMTP id t35-20020a056a0013a300b0053706afd2aemr1756212pfg.54.1661253543367; Tue, 23 Aug 2022 04:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253543; cv=none; d=google.com; s=arc-20160816; b=ArYK/amZ3BraSAPAzGlRKfburtfRzEJQSR2o4vas1HDTcGVjJ/FxtwZJ/LTv7oDTJy zSuwnI7K5Acvw2+t0IHn/YEE5YT6YnwfmP2XFWX4ktoeYVvGpU6td+Ns8MgKO1jGckbp fdpLbhxCdVKPHz2amqYcHjfleag++iCbGgsAdNlaVC7K3bbMyCBL2lzEUPINKUcDBBly L01xszAIzOvGHlM7usFlq45y6j/uk5+TcqKg0g5XK895NVR1gS80e/ExIvK/Ld+b4vcx lX57KTkZ1JPnP7yUyK7eRRGTcSBzpMp4skdh882IhhzARuesEE2nYw6GV+uZriblzD8J iTng== 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=JliqkFlxDAhRCDdtgHypdnq+fxJ64TiEiQI/VUAaS7E=; b=GaNtKeEjb9OabCiOndo9KgU9ui65dM7nBg0IM92R6tL4mVlQs8F7dcUxRsXJ0K40U+ d7XwV18FBsyBBm7ze5V02LipCvEvKp8TYf/e2sBLKFqp/nUzp4ANVOPW64RQamvRPuXa ax5wxS0cAojPjLx9RSm02vvIwPIzn1JiZMLHRvOfdkCc/u+PihheKqapZnWXIJXaKge+ IbwF90Y5Bb1OAngYyViF7Xp7Unw0Y5ugTmlJofuu6xUf+Va/PrGrL7Kn6WwTiw8xCW1S qr38YrQrjpU7bPL+yPHukjST5f6VqguE6sPx2m4S9Els5PGEombIZpGr7mNYHuEXXtpG 0kcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DxIlpNJp; 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 z13-20020a056a00240d00b0052b8a92ed84si16261789pfh.172.2022.08.23.04.18.52; Tue, 23 Aug 2022 04:19:03 -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=DxIlpNJp; 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 S1349298AbiHWJR7 (ORCPT + 99 others); Tue, 23 Aug 2022 05:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347922AbiHWJPc (ORCPT ); Tue, 23 Aug 2022 05:15:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F986DADC; Tue, 23 Aug 2022 01:32:14 -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 F285B61257; Tue, 23 Aug 2022 08:32:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FD87C433C1; Tue, 23 Aug 2022 08:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243533; bh=CGcBH5rQ3CR51QKmCPkYsyRGCuTCXCRNzB1PPUJkLT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DxIlpNJpuP1fxKNsFobfTKfaOKkKRtFQdlFSpmHVeEqnPtdJPPXhJw4ghXlABbKkc cTdnDWG8Q/dMha6aL7XakjnJXmGscNBHZr8Rj3N/DpHahFeiXCZAMRBxM2omgrWfqD zAB4Fd0ZCni5jtR7oPsNbzQc20hKxSNKKEuQS1go= 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.19 307/365] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Date: Tue, 23 Aug 2022 10:03:28 +0200 Message-Id: <20220823080131.028457465@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@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 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) -- 2.35.1