diff mbox

[v2] mmc: mvsdio: Replace IS_ERR_OR_NULL() with IS_ERR()

Message ID 1357889273-11553-1-git-send-email-andrew@lunn.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Lunn Jan. 11, 2013, 7:27 a.m. UTC
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 <andrew@lunn.ch>
---

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(-)

Comments

Jason Cooper Jan. 13, 2013, 8:43 p.m. UTC | #1
On Fri, Jan 11, 2013 at 08:27:52AM +0100, Andrew Lunn wrote:
> 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 <andrew@lunn.ch>
> ---
> 
> This patch depends on Thomas Petazzoni DT patches for mvsdio, which changed
> the order of resource allocation etc.

grrr, I'm seeing fixes depending on features :(  Any way to avoid that?

In light of Russell's comments, shall I wait for a v3?  All of Thomas'
mvsdio work is now waiting on this.  I'd like to get that in as early as
possible.

thx,

Jason.
--
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
Andrew Lunn Jan. 13, 2013, 9:42 p.m. UTC | #2
On Sun, Jan 13, 2013 at 03:43:48PM -0500, Jason Cooper wrote:
> On Fri, Jan 11, 2013 at 08:27:52AM +0100, Andrew Lunn wrote:
> > 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 <andrew@lunn.ch>
> > ---
> > 
> > This patch depends on Thomas Petazzoni DT patches for mvsdio, which changed
> > the order of resource allocation etc.
> 
> grrr, I'm seeing fixes depending on features :(  Any way to avoid that?
> 
> In light of Russell's comments, shall I wait for a v3?  All of Thomas'
> mvsdio work is now waiting on this.  I'd like to get that in as early as
> possible.

Well, im guessing doing the fixes first will require changes to Thomas
features. 

Did you try putting Russells patch in first? How bad are the
conflicts?

	Andrew
--
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 mbox

Patch

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;