Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp343405pxu; Tue, 5 Jan 2021 12:33:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1mzqpE2u08d8nxBPXT6IruuRW2Q9mLnOjbKDAjCF/GkXQHdna3IQz1+1j0+Mk5czsWkNs X-Received: by 2002:aa7:da03:: with SMTP id r3mr1533753eds.155.1609878786954; Tue, 05 Jan 2021 12:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609878786; cv=none; d=google.com; s=arc-20160816; b=g15Hgq3h7r4Q8kAuKdEepTXAAPIH13+5cPW1DLt4h/TxuvNj83yVNIEJENU49znuy1 wzBc14sxh+nsIJoZBWZi88lx5HzFkYhWie62AT803fQcLjanIuJAGcZfOg980cGKQ1dN NqXfXl/PcNjlEQkmtrMIjZap900q2eAAWZthGo8wW4O6t03Rs5lY5w/wtb/ZhyMMijlC GGnQnME2oMc47H/+8ExuFYEt1H3ODP3N8Z3Ajx3l6xISaW5BXe7abOZh8u93f12+I+82 gFsMcVT9v+9ShUjDzUGr7YuFekK556q49Np7PY68cdwP66jy5dyV6SBu+htnARQWB7z2 K+VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=kZJ9CwDZUYs3Hq9TnejQDmKYICcIGwIwA0GGzBGSrBU=; b=kxnf0c5epVhNk+w2lyqZZB/jQ5QWROsKkVTaa58pjPzBJlvrjif5Iy12KQSGb5owpi d56cdbX0wCH86a2nYcJjnHj9xPJgNkb80853mRBM6lKXbgmvIm5BeHWmQ50bHP2htGPN X+bh5BlbZYGxtU5py55qmk/Z7I7rtGfoLz6vOffrvFUf4n6bOXT4YK+nDhAk+iVb5DqO /pyhjv/5CZDte5jxh7uUDCHxZB6aITjgny0Xq/65pv8F2s+9nUsRo3S0chgOT6pVaLSZ EjX0XHY6MtkeMHPR2cPKs3CstrmpW1nwtwkKT6RmtnSTBMLV1aTi8Zgnq/q8XOFZRmfx pK5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si70624edy.244.2021.01.05.12.32.43; Tue, 05 Jan 2021 12:33:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbhAEMkv (ORCPT + 99 others); Tue, 5 Jan 2021 07:40:51 -0500 Received: from mga04.intel.com ([192.55.52.120]:62363 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbhAEMku (ORCPT ); Tue, 5 Jan 2021 07:40:50 -0500 IronPort-SDR: tBEJiEVrWBLAWAxamEYe4L7ef4o0elxzm6H3DvSjQvmfOIjsHAVZyXShi+UeIojvuGYECuX+di wut3vzxX0vkg== X-IronPort-AV: E=McAfee;i="6000,8403,9854"; a="174522447" X-IronPort-AV: E=Sophos;i="5.78,476,1599548400"; d="scan'208";a="174522447" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2021 04:40:09 -0800 IronPort-SDR: 6IkOAP8MjGH/55q5jhZv/PwNqde/HhlTyXkBbEhuLnYqyG5Fv6u6PZ1FXQAKnJF+IXsFmgeDuX lxq3BIYT4zZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,476,1599548400"; d="scan'208";a="421760825" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.94]) ([10.237.72.94]) by orsmga001.jf.intel.com with ESMTP; 05 Jan 2021 04:40:06 -0800 Subject: Re: [PATCH] mmc: sdhci-sprd: Fix some resource leaks in the remove function To: Christophe JAILLET , ulf.hansson@linaro.org, orsonzhai@gmail.com, baolin.wang7@gmail.com, zhang.lyra@gmail.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20201217204236.163446-1-christophe.jaillet@wanadoo.fr> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <1cfeeb62-8211-4a2a-0cf5-c3799d7ef42e@intel.com> Date: Tue, 5 Jan 2021 14:39:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201217204236.163446-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/12/20 10:42 pm, Christophe JAILLET wrote: > 'sdhci_remove_host()' and 'sdhci_pltfm_free()' should be used in place of > 'mmc_remove_host()' and 'mmc_free_host()'. > > This avoids some resource leaks, is more in line with the error handling > path of the probe function, and is more consistent with other drivers. > > Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller") > Signed-off-by: Christophe JAILLET Acked-by: Adrian Hunter > --- > Other adjustment may be needed. > I'm not sure at all of the 0 passed to 'sdhci_remove_host()'. Some drivers > pass 0, some have some more complicated computation. '0' means cleanup nicely. '1' (dead) means nothing works anymore, including interrupts, so give up on requests immediately. Either should work. '0' is better unless your host controller really is dead, which is mostly not possible except for some legacy PCI devices. > --- > drivers/mmc/host/sdhci-sprd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c > index f85171edabeb..5dc36efff47f 100644 > --- a/drivers/mmc/host/sdhci-sprd.c > +++ b/drivers/mmc/host/sdhci-sprd.c > @@ -708,14 +708,14 @@ static int sdhci_sprd_remove(struct platform_device *pdev) > { > struct sdhci_host *host = platform_get_drvdata(pdev); > struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host); > - struct mmc_host *mmc = host->mmc; > > - mmc_remove_host(mmc); > + sdhci_remove_host(host, 0); > + > clk_disable_unprepare(sprd_host->clk_sdio); > clk_disable_unprepare(sprd_host->clk_enable); > clk_disable_unprepare(sprd_host->clk_2x_enable); > > - mmc_free_host(mmc); > + sdhci_pltfm_free(pdev); > > return 0; > } >