From patchwork Mon Oct 2 06:29:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Woody Zhang X-Patchwork-Id: 728687 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 0B536E784A4 for ; Mon, 2 Oct 2023 07:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235656AbjJBHH1 (ORCPT ); Mon, 2 Oct 2023 03:07:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235601AbjJBHH0 (ORCPT ); Mon, 2 Oct 2023 03:07:26 -0400 X-Greylist: delayed 2162 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 02 Oct 2023 00:07:22 PDT Received: from out203-205-221-191.mail.qq.com (out203-205-221-191.mail.qq.com [203.205.221.191]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DFA6BC; Mon, 2 Oct 2023 00:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1696230440; bh=/va6eC4+0cEIiwSVm3cTBhnxHL1n1Ys42lzQlFSbemA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EH5353Zm1ORPKHjjH35V0B5RfmVJZBe8YuquinZrDw7sKsMlG1Tlsc5+zXIFSNY94 u9WBuRDm8lKmoGMnx95+NaqebNj1nwwlgJCEuedU/lF+BYgx+128MZEUdGkseGdkeZ fjQhqiZ6unQXUsiyO/W96ekdLyn1gP21y2gcnbW4= Received: from localhost ([124.78.196.55]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id 7D027EE0; Mon, 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THZQ2bnX+bQ== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Woody Zhang To: Mark Brown , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Woody Zhang Subject: [PATCH 2/2] spi: sun4i: Fix memory leak on device removal Date: Mon, 2 Oct 2023 14:29:59 +0800 X-OQ-MSGID: <20231002062957.1741396-3-woodylab@foxmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002062957.1741396-1-woodylab@foxmail.com> References: <20231002062957.1741396-1-woodylab@foxmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Call spi_master_put to free the spi_master structure on device removal and driver detachment. Signed-off-by: Woody Zhang --- drivers/spi/spi-sun4i.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index b8947265d329..ba5690039f72 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -518,7 +518,10 @@ static int sun4i_spi_probe(struct platform_device *pdev) static void sun4i_spi_remove(struct platform_device *pdev) { + struct spi_master *master = dev_get_drvdata(&pdev->dev); + pm_runtime_force_suspend(&pdev->dev); + spi_master_put(master); } static const struct of_device_id sun4i_spi_match[] = {