From patchwork Fri Jan 11 07:27:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 1964791 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 037D53FE37 for ; Fri, 11 Jan 2013 07:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753844Ab3AKH2M (ORCPT ); Fri, 11 Jan 2013 02:28:12 -0500 Received: from londo.lunn.ch ([80.238.139.98]:44475 "EHLO londo.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570Ab3AKH2K (ORCPT ); Fri, 11 Jan 2013 02:28:10 -0500 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1TtZ20-00030t-00; Fri, 11 Jan 2013 08:28:00 +0100 From: Andrew Lunn To: Jason Cooper Cc: linux ARM , Thomas Petazzoni , cjb@laptop.org, linux-mmc@vger.kernel.org, gmbnomis@gmail.com, Andrew Lunn Subject: [PATCH v2] mmc: mvsdio: Replace IS_ERR_OR_NULL() with IS_ERR() Date: Fri, 11 Jan 2013 08:27:52 +0100 Message-Id: <1357889273-11553-1-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20130111004323.GA12257@schnuecks.de> References: <20130111004323.GA12257@schnuecks.de> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org A NULL is a valid clk cookie, so we should not be tested with IS_ERR_OR_NULL(). Replace it with IS_ERR(). Signed-off-by: Andrew Lunn --- This patch depends on Thomas Petazzoni DT patches for mvsdio, which changed the order of resource allocation etc. Simon You are correct about the indentation. As suggested, i moved the disable_unprepare() inside if (host). It should no longer be possible to have imbalanced clk operations: If mmc_alloc_host() fails, it goes to out. host is NULL, no clk calls. All other goto out occur after the clk_get() and when host is !NULL. clk calls are then made when !IS_ERR(host->clk), keeping this balanced. drivers/mmc/host/mvsdio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index feb16bd..196f085 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -818,14 +818,14 @@ out: mmc_gpio_free_ro(mmc); if (host->base) iounmap(host->base); + if (!IS_ERR(host->clk)) { + clk_disable_unprepare(host->clk); + clk_put(host->clk); + } } if (r) release_resource(r); if (mmc) - if (!IS_ERR_OR_NULL(host->clk)) { - clk_disable_unprepare(host->clk); - clk_put(host->clk); - } mmc_free_host(mmc); return ret;