From patchwork Mon Oct 2 06:29:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Woody Zhang X-Patchwork-Id: 729215 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 1E7F9E784A4 for ; Mon, 2 Oct 2023 06:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235519AbjJBGbU (ORCPT ); Mon, 2 Oct 2023 02:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235524AbjJBGbT (ORCPT ); Mon, 2 Oct 2023 02:31:19 -0400 Received: from out203-205-221-155.mail.qq.com (out203-205-221-155.mail.qq.com [203.205.221.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A8F5DA; Sun, 1 Oct 2023 23:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1696228273; bh=kX93wG8sDvK/NYNskFqLEmdWnX99G5sekJ2NkAtEEsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vCLTs4r1NfyHuQVDcDd8PKnW2nJccRaJX3oJbjLqvYw+K9RWHaO26Ug3ps53/yfAT pNuZOeUp0ErF4yx7bZPWMi5/1N1TLPF+ZJ7YKdNIZFgMA1B7NrgmR6OyfP4oBcOJ+X XT0U86VTIySy67q8xGEuQTHP6l1tInialJPrzuKc= Received: from localhost ([124.78.196.55]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id 7CBA4A46; Mon, 02 Oct 2023 14:31:11 +0800 X-QQ-mid: xmsmtpt1696228271topi6npl5 Message-ID: X-QQ-XMA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m6loJ0 e8pxYPbA== 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 1/2] spi: sun6i: Fix memory leak on device removal Date: Mon, 2 Oct 2023 14:29:58 +0800 X-OQ-MSGID: <20231002062957.1741396-2-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-sun6i.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index fddc63309773..33cec49d5538 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c @@ -774,6 +774,7 @@ static void sun6i_spi_remove(struct platform_device *pdev) dma_release_channel(master->dma_tx); if (master->dma_rx) dma_release_channel(master->dma_rx); + spi_master_put(master); } static const struct sun6i_spi_cfg sun6i_a31_spi_cfg = {