Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2463513pxb; Mon, 11 Jan 2021 10:13:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmaUA/4FL9VjWb8Q+rQaEAERqliKIDR8aaAworQEmpFLmi3aD7eCG7xVrnMmQTIwsyIcAd X-Received: by 2002:a17:906:3fc4:: with SMTP id k4mr466820ejj.137.1610388810102; Mon, 11 Jan 2021 10:13:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610388810; cv=none; d=google.com; s=arc-20160816; b=RAB3gzg1IKadotzHBGiPQk2760ZYMcoYjEaPycsm2v1lorkom9RHMdX/CUh3wlTxx1 eAyDDSowSKkYXzbDfbzOtGVIEAdpbjygAQdYjItlLSluJ7vAbFel22WUcQMghfumpuET DnA1cN7gvAb/5JP63huvBroWQCD8PXUDCURP2VNHXze+9Wyw0Btz8fjd8Q2m+C7vxFzL xE5EaPrSKioAWc4/Vmo1O5RJIKRoeCpSc3UxV3AYREO7SMfj4kL6wneTiNUGohTodPan VuG3UKtJvE3hIvL65vtJWjLGtwlklEFGBIFYgBm0sb42LOv1N2tae93ICwak+vLh1JAG VrGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7rSaSXYtTxYYwGraW6wIoFcN9Tx4ZDoszxpT3cBQ0d8=; b=0+HzUIuooNe4nb7oBAf92hFT21iMowL3sxeey2NbKrIjV3kFDP86Cb9KUnw+OYKE2P tY+nR9M5hiEu1+qQPKOljYmS0AV+g2WoJgRlLJRapXGgWrbkD4D34eeuZXIyMAZBp6ym 8aFMkeqPuYeyx/0roDK+hw9ARBkIUvu2slmZSX5oQAd5Gx4suo9eGYppjkKc0erABDTC 7RyCqI2IfR1oTfUexrev0BfRhNQS7RnbEBe2tGVNYEsi0D1ldt1XwUlELabNEMn0IjsU 32/hkUZB1+yeCL6mtX/XZWRHfbcfXXu2im1Fi0oC5dyC8wOYH+yaKJ0DbRywHWRYcpiQ CMmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PsqDgtDl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si211193edg.1.2021.01.11.10.13.04; Mon, 11 Jan 2021 10:13:30 -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; dkim=pass header.i=@linaro.org header.s=google header.b=PsqDgtDl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390062AbhAKSH3 (ORCPT + 99 others); Mon, 11 Jan 2021 13:07:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389739AbhAKSH2 (ORCPT ); Mon, 11 Jan 2021 13:07:28 -0500 Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B57CC0617A6 for ; Mon, 11 Jan 2021 10:06:16 -0800 (PST) Received: by mail-vk1-xa31.google.com with SMTP id l187so48820vki.6 for ; Mon, 11 Jan 2021 10:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7rSaSXYtTxYYwGraW6wIoFcN9Tx4ZDoszxpT3cBQ0d8=; b=PsqDgtDluvIkHbnqK8iRlcVzhhDU4dNLs+8Ut7PCKvLva3uRThDp9DA/vcJGkWTmbU 3VdJt9hRopVglpRijAKhO02irQRFWA1ce/A853mESG1pqf8+JdvAmo9Xl7KjVCV6QkDS MLXQszD8IIrZUGkdQbcM539sNcUGeHUUzPcgJti4UCnQ2XZUPk5myGDKOgeNQCo+FLSd n6WuS8t2TPXEUyJDCz0QWAgxIvJ7jzLFgHFvQWpZF8WFyqugntKazxyxFCAn3CZd/yVS C554VEFPi0t9fNL9Ln2aiskpbgDo2b2W8DMEQnT3nRlZAF59tRUWvS9kCe5f3rO1i2Gx Qipw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7rSaSXYtTxYYwGraW6wIoFcN9Tx4ZDoszxpT3cBQ0d8=; b=Fn5Dq/zmNjbh03op6h0gKx2aipNwZprDBDHyG+kkFkxf6Jp1DlO6y8YLIdRJw2q4pQ IVPxQbAYpbSLq6TCXK6C7OLWc73PpraLuxbHiw0/mF53HlhgoRNd8O+gGf9lvEbxh4B2 rOq43XPU5Zw1d/ZtUX3GNBLu/OT57EppCQ+4Pf7xgn5yEwNGEa1fxulbMSZLuOhPa1v4 zoyntSpQsUmuHkUEgv0DsvP23aF6IM+lhaBYABIZcg5P2QKrUdUSLz6DfATUjqQ5vQah blIjGVh3C4Ir/MK5JY7+SyYPGtDRBXgwx8X4GK7RuoQ0lIANqGbc5WY6yuufB8vZ4GJP QeVg== X-Gm-Message-State: AOAM530SY3SDEXd/sCWgHpik2WGVvvxm0mRl231KPicFjmgjgF5Kps9L g9vFt18ru32GT9zYscjOLby4wUy7+0qpkmW3qzVaxw== X-Received: by 2002:a1f:2b58:: with SMTP id r85mr1159961vkr.6.1610388375412; Mon, 11 Jan 2021 10:06:15 -0800 (PST) MIME-Version: 1.0 References: <20201217204236.163446-1-christophe.jaillet@wanadoo.fr> In-Reply-To: <20201217204236.163446-1-christophe.jaillet@wanadoo.fr> From: Ulf Hansson Date: Mon, 11 Jan 2021 19:05:36 +0100 Message-ID: Subject: Re: [PATCH] mmc: sdhci-sprd: Fix some resource leaks in the remove function To: Christophe JAILLET Cc: Adrian Hunter , Orson Zhai , Baolin Wang , Chunyan Zhang , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 17 Dec 2020 at 21:42, 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 Applied for next, thanks! Kind regards Uffe > --- > 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. > --- > 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; > } > -- > 2.27.0 >