Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1552948pxu; Thu, 17 Dec 2020 12:45:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrezCfg9HaFU0Z0BT9gAwseW8cUQG3R0EQco9bn37MmFeCpv1W+V5H928Y3KIUEC9MCWn7 X-Received: by 2002:aa7:c358:: with SMTP id j24mr1172535edr.265.1608237914712; Thu, 17 Dec 2020 12:45:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608237914; cv=none; d=google.com; s=arc-20160816; b=iq4p+VhRuM237AEv1gZFI1F/kUKIbhXa1pGMSIUfPbmgAPP8jEJvSmhBs3ImhMaQ8N yzWnhwHfVlFO6thwEm8jzJijUgVCDo7bPxF0CsEyjPq/heik6ltE8WPp+piuWuKtt4hL HVlS9QkxSa+WxvZBAdIN5TSLMaX/JHlxAQb1I6EMbQ3bOLMPKJqx/e4oJqD2iBpt7N92 KOWVLIwghIDXYhtMoaJ/mFKsBo4U2e1dzM8I/Pz703kUHLR4AZZt8uXrv95BxXLsIfbq 1wI3xJoiu3DtGxJ06JokbPSwcU1XE0c1qKZKVb0pZLAduwGlY20/hGLGw/MwqmqkVISB DXTw== 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 :message-id:date:subject:cc:to:from; bh=3BmgIeobWOjOib1AGMMoGz2i+PTsQUI+ApkZhqYCsho=; b=l1+wByQlCi1o+8m74bGGqfOo18XoZdISgIKK5vHZ/25kjYamzUQ4k77fyx0MRW+zF+ TWxrpeBZWyII5YpvbtysALD8dTrk12Y6+fj4uNhngZCchGAPrh/1Iazl9xKiaLL9AWGc nsWxRtVvVdjmPdaSYvCUXnk2Y33AqCsQWVDmzYJ9OYip/5fSvcpht6Fduz3IBC55BN1y uRxHcHqU3kKskvExrd1HinXvvpcisIxuvwyadCUo3p0Pa/SRTP6fscYEPCppn/w34iqF t52imaFfUqKretDz4Lx2Pu7rpwR/chpkwgZjS/DLn/SAmnwMuzTsA+WqyXIZyA4i9wU3 RnjQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si3473988ejg.660.2020.12.17.12.44.52; Thu, 17 Dec 2020 12:45:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725988AbgLQUoV (ORCPT + 99 others); Thu, 17 Dec 2020 15:44:21 -0500 Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:32239 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726951AbgLQUoU (ORCPT ); Thu, 17 Dec 2020 15:44:20 -0500 Received: from localhost.localdomain ([93.22.133.164]) by mwinf5d84 with ME id 5Yia2400B3YyeAd03Yiaxi; Thu, 17 Dec 2020 21:42:36 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 17 Dec 2020 21:42:36 +0100 X-ME-IP: 93.22.133.164 From: Christophe JAILLET To: adrian.hunter@intel.com, 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, Christophe JAILLET Subject: [PATCH] mmc: sdhci-sprd: Fix some resource leaks in the remove function Date: Thu, 17 Dec 2020 21:42:36 +0100 Message-Id: <20201217204236.163446-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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); return 0; } -- 2.27.0