Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1636745pxu; Thu, 17 Dec 2020 15:05:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0JuQe7Xsw+Pzt73s5qOame73j560QIF9y+vRpZStBdbsd2jDNbclkNAF6mTe8PjHvJcn1 X-Received: by 2002:aa7:d750:: with SMTP id a16mr1711578eds.252.1608246323884; Thu, 17 Dec 2020 15:05:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608246323; cv=none; d=google.com; s=arc-20160816; b=fYtzhygklaPed2WJJGkJG5Pag3b0kpPDK34xPKEhm7HNVzcuDXO5cPCoDrSjwPE/6b 89wls9IIaMN+AZSLzIwCutwilF6gGwEkBVvLj3+8HCU7eMcPY9aH0p7IIu7JZiQnwqtR mr0nzWwaEuxua4wC2yFqk0HjRxBiQ40Vd+y4oVWY1iV7Kuck2pCZJOCwokoeOYPdlWEh 1Y9ecwAIHt/EKyQbGKtToPamLaLjM5SZVFeRJv/sTGhsUYl4XyIZ7W5hcYpbaqfOawZu ip4OISCtTv6PNW8+A9OA5aGOi4h6th3P5pdyTcvUHQiXksQ8tx5XBpjmAYMdtVAVUYpj 0ZqA== 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=Cb7FwoEM95bPdPXQJmHT4TufQ9QvBdIpL47kT7jRkDk=; b=WV1KCjziyy3SnYtXKX291ZlhXn+mDEaTTTROph1kr42mEJaTELAoQpiQAmK+kWRIFl ITYBCe7XXQEKEGECZJfUxtWe4MhBMijRXPeUY5PnO06cTihhy1kSxSEuqPuvopwA+V/R nz28Z6wkhuxw8SE3BzNAfiTqa3BIGFxNNTGoJ3b63xTAPdqs3/+SiwJ7DpfqctdySyvC T+grwNKPi/4ifWu5NZs6Exqxtj33e7WPGD+RkdHbLx9HzviTf+iln1SSK76QxV4TpjZN Foj1K5gi0VZ4J4W9OQeHk/t6X8U1I+zb8IGJW9T3s7GXFE74noKg3HXmULvCCkNme8Mm GlNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g5UXcBDD; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm17si3798753ejb.131.2020.12.17.15.05.01; Thu, 17 Dec 2020 15:05:23 -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=@gmail.com header.s=20161025 header.b=g5UXcBDD; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732267AbgLQW4E (ORCPT + 99 others); Thu, 17 Dec 2020 17:56:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732168AbgLQW4E (ORCPT ); Thu, 17 Dec 2020 17:56:04 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E37A9C0617B0; Thu, 17 Dec 2020 14:55:23 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id n10so95258pgl.10; Thu, 17 Dec 2020 14:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cb7FwoEM95bPdPXQJmHT4TufQ9QvBdIpL47kT7jRkDk=; b=g5UXcBDDuNrzI7H4Ezzci/0lZaIxdyUG6zYZBGiAtm382qqTwa3RECIG+/oNwblzN6 k4A7IWdGlxY0EozpbSDtMU1Hwh2vZZk/1C1tg/S3FTkmlvb3SaX7k2vZPIAHN9xYTcfv nuLCQQZ6uJOxI/1Px998F3V5Rc/f+s64ZOkK6LW1txpPkDw6SOynFgSDYulJ78Jdg3yk 7uOH44UFLqedsBer1o0b8+LPt0wmWLY5kLBAd8wzYl62NsTB7qBKZ4nybXWiwUCT5u5A oZWDQNK6gfnrtuwEY1e80MYRJSNBgKxSw538Vx3HUjxDdP6pO6vs9bZ8/6/jCoqbmZiF fBzg== 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=Cb7FwoEM95bPdPXQJmHT4TufQ9QvBdIpL47kT7jRkDk=; b=k5rUuEr/TENELJ1tXsqbHZ/oDmSYOqwIQ7OVwNKYTUK4Kn9bZYL+0LckVpqBvMqgMw OckLdx1mrNbAW7sYYxkAqdfLK8nZUYjlAs7Lc8hAMiPggUTuHj13sCrZUE4BpIIwTQlp lxZ37gpyrbZJZzSi1Yqvq6mOu06vkVj6wI6u6RZpmvNLS1O+Plx4YRNwBWoby3BSP1MX 0CRx8Dr0Nmwui5fpim0/AiUm7LcbLQCDmksKo9oig0+c3gNuwUM4ETw9kItfIUkxtJBH HdK/vVlZNe6wGWqTBZHleqV/ELIRHO9YLO1Kif552y5h9VrDdaJpLujwK8N83fHndTUS +Lrw== X-Gm-Message-State: AOAM531Z+YJluJ5V1xAOV/5jopCh0RMIJIyh8BzPFBjCa6jAhaL1tJMF mKHbYKXZb0QL5f6ARlp+tCWu0WoHJzGocfoMhZ8= X-Received: by 2002:a63:2882:: with SMTP id o124mr1398512pgo.11.1608245723518; Thu, 17 Dec 2020 14:55:23 -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: Orson Zhai Date: Fri, 18 Dec 2020 06:55:12 +0800 Message-ID: Subject: Re: [PATCH] mmc: sdhci-sprd: Fix some resource leaks in the remove function To: Christophe JAILLET Cc: adrian.hunter@intel.com, Ulf Hansson , Baolin Wang , Lyra Zhang , linux-mmc@vger.kernel.org, Linux Kernel Mailing List , kernel-janitors@vger.kernel.org, billows.wu@unisoc.com, Wu Hongtao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + cc: Billows Hi Christophe, On Fri, Dec 18, 2020 at 4:50 AM 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 > --- > 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); I saw a lot of drivers also use mmc_free_host(). Do you have patches elsewhere to clean them? Thanks, -Orson > > return 0; > } > -- > 2.27.0 >