From patchwork Mon Oct 15 09:43:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 1593061 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 09B273FD9C for ; Mon, 15 Oct 2012 09:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751819Ab2JOJpG (ORCPT ); Mon, 15 Oct 2012 05:45:06 -0400 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:52428 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746Ab2JOJpF (ORCPT ); Mon, 15 Oct 2012 05:45:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=5s7Q2xNb11sziHtavPFkZS8euF0/gHEBBTpA6xQmwrw=; b=Qs4eponfv0lAx9F5x4DzDceALqufy0uk2lPqTw3NGAe3N5hFizq1b3/rHH/2V6GOlQU4LaI6fezge25UFffuLi/TBrCJoCE+nVaEIGcLRkDa3R1FH7PpxR4j/wHJoUccv1ec/EhANm+kWDvibOJN05l12cyTjBeF+pT33K57CiY=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:32926) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TNhDB-0007Xb-RC; Mon, 15 Oct 2012 10:43:50 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1TNhDA-0004ex-So; Mon, 15 Oct 2012 10:43:48 +0100 Date: Mon, 15 Oct 2012 10:43:48 +0100 From: Russell King - ARM Linux To: Chris Ball Cc: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org Subject: [PATCH] MMC: fix sdhci-dove removal Message-ID: <20121015094348.GP21164@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 1. Unregister the device _BEFORE_ taking away any resources it may be using. 2. Don't check clks against NULL. Signed-off-by: Russell King --- I noticed this while merging v3.6 into Rabeeh's cubox kernel. drivers/mmc/host/sdhci-dove.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c index 90140eb..c11db64 100644 --- a/drivers/mmc/host/sdhci-dove.c +++ b/drivers/mmc/host/sdhci-dove.c @@ -117,14 +117,13 @@ static int __devexit sdhci_dove_remove(struct platform_device *pdev) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_dove_priv *priv = pltfm_host->priv; - if (priv->clk) { - if (!IS_ERR(priv->clk)) { - clk_disable_unprepare(priv->clk); - clk_put(priv->clk); - } - devm_kfree(&pdev->dev, priv->clk); + sdhci_pltfm_unregister(pdev); + + if (!IS_ERR(priv->clk)) { + clk_disable_unprepare(priv->clk); + clk_put(priv->clk); } - return sdhci_pltfm_unregister(pdev); + return 0; } static const struct of_device_id sdhci_dove_of_match_table[] __devinitdata = {