Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1165844rdb; Mon, 2 Oct 2023 00:38:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYc2pS1L81VFbq1yOf12WXBPg5FzscDcrBJ7Nqur1EEgMIJEyTCVS72j70ne7Jzd2bLwz2 X-Received: by 2002:a17:90a:3004:b0:269:6c5:11a7 with SMTP id g4-20020a17090a300400b0026906c511a7mr8768086pjb.17.1696232320590; Mon, 02 Oct 2023 00:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696232320; cv=none; d=google.com; s=arc-20160816; b=W261HwQ8cggfnRmAJeVxGAIVCTN/38nFNdv/pShvDdQPVFak13dynD/ab4FItme+YJ klnUkDXnaMlCenjthkoSCZANnINlS+mdj87CuU6ETs/AbRD7OV1gzJ180eACetzFYGNl y8ea70DkzVOHPjZEwNuQaZMFeWHRFWt9F3z0GDF0RWD49LKEjIHdupQ4D8gShglUD+jO 68AMrPQmx7FvfRnrFFEgUABcZt7zS3anKN9mtTzG+u6EcxrFtMWIxEW0vew0dTSbdWKZ +01+GvCwuf71lLuRfDZjl8pcNYPhgxKRwB4HI6zxYF4OCdlYxRw6Q+O3WtXHrmLw5jXj xP/g== 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 :references:in-reply-to:date:subject:cc:to:from:message-id :dkim-signature; bh=/va6eC4+0cEIiwSVm3cTBhnxHL1n1Ys42lzQlFSbemA=; fh=aXZP9pmpVi9BEN0hkl7DS0oRwdUevA3oDSW2PJtfFWA=; b=0kq76czBak+CQzKY85tY9AMzLQQvsNOclSh+N1X8YIOnz470h1mwxmyWs1VE+icGMf PILH6I+SYfFrKzMESGaUcmgTFbAfzZmMjUg4q5WGipV+lyAukNAoVUohcYYy2yxSiOGX KcMrVQmGPKRAXcxTtqkAoOG5WvrsfNuGaUDYuaydMgu9czDyRXJ9e+/9wUeW4gvl/LGX K6Ut+NvbkMBcobVIBtDmn+aOFmOIand7XNkDnGORs94BpbjxYtuzxePU219/6A0HhGiT D5Ggu4k8KG8X/HGYz1Kvy+aKZPEsdeKMBZX66VX37wNeFu0fKz8gmpJp7Hw1W8Bbq9G9 nTAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=EH5353Zm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d22-20020a17090ad99600b002719ad11d97si7004747pjv.137.2023.10.02.00.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 00:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=EH5353Zm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 713B580267D1; Mon, 2 Oct 2023 00:07:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235684AbjJBHH1 (ORCPT + 99 others); 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, 02 Oct 2023 14:31:16 +0800 X-QQ-mid: xmsmtpt1696228276t3iuj484p Message-ID: X-QQ-XMAILINFO: OZZSS56D9fAjFJK57+xHWtgp8Z39avrTzcuiK+PjLSh5axQe5xVL+LS3/vkmak 04R/P60x5pNZylcwXW4N3oapc9mgvzwLudqmrxKo28ib34Tl13D2cqrUCQTjcD+MjjBDyvQvukvq BcsilxEc2SSPTn+n1IdDPDB9qegPhUsqeT4G0wWn+ijKYbSleaCx6VQchRvU9e75owWkxhyw/p8h a7TQTm0Fwn0EU2zBa/T4NjkFhXRN0kY218B0HjA9S6X6Cd07NcGXI2+u2InqDrS6+7Fuz+9FeTnu 0PilEjcl6eufObl0uFrKy5/dXnyeRwejqFOshgUwQzBeSNCFtHS4XGzBQ4qCQGDHdCwefGFhyNLm 0VKYqaUycHLvERKALUrbBvaT/FycmJy2EPxxYJldf5T9ugHas4XePfN/lQdGZwDrlkZ5hIBGc1wi A8LQkf+NkNUKgG2cyWB2X52KQLlRX2ttutj5oGOHG/Sw5J8qERJqrcFQjaKkhdT7YPIttQuhCYgD 3AsaYPz3eR0Zq1Sa5GovJ+bUTUm6R+L9niqvAiD6vs37Ki989fqlZbDiI1LmxNiYKnoCtiVPLzMT SIbROkkG9s1ylHbpbnkyI6sCgUdoriTWjD0+KZ5bpGWLVNz7YQIQwwJKKQFPAtHFRk5qxl9PdBMQ BT3KCln0BDMfXljPlP5fQ14Hm6d87COuhmhUacfieBAO7Z127FsHXZPcl2b9VV49v8yXp5Pi3gi7 kMaXbUe44lGXHWuKyk+ZYBdIc386DblEMHE25czUzAaVrU/Kf7KGORLPtddIegnayvWeZPB2nxpF pV/G0rm2l8XitFf3/e+WgTgOYZEK9TBohuwNKnnOM1kpiFOkfpJM83+/kZVezAucdnnAcXgmxp9N WQIjeSamjCupVzEeBXzvMbNkp1UAyy1trJMDSwVv5UYzHfA9tWHW71Jr7619giCzv8i3i+eb5E4V YtT0oKCQmKPBESBQl3EKfm8E6ss8AYRWFRpInXcNjTHZQ2bnX+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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_BLOCKED,RDNS_DYNAMIC,SPF_HELO_NONE, SPF_PASS autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 00:07:30 -0700 (PDT) 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[] = { -- 2.39.2