linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marek.vasut@gmail.com (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] PXA: Reorganise pxa2xx_base init() function
Date: Sat,  2 Apr 2011 03:43:17 +0200	[thread overview]
Message-ID: <1301708597-7413-3-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1301708597-7413-1-git-send-email-marek.vasut@gmail.com>

This kills dead code and kills some redundant code.

Original idea by: Cyril Hrubis <metan@ucw.cz>

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
 drivers/pcmcia/pxa2xx_base.c |   30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 2c54054..687d203 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -296,18 +296,20 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
 		goto err0;
 	}
 
-	clk = clk_get(&dev->dev, NULL);
-	if (!clk)
-		return -ENODEV;
-
-	pxa2xx_drv_pcmcia_ops(ops);
-
 	sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
 	if (!sinfo) {
-		clk_put(clk);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto err0;
 	}
 
+	clk = clk_get(&dev->dev, NULL);
+	if (!clk) {
+		ret = -ENODEV;
+		goto err0;
+	}
+
+	pxa2xx_drv_pcmcia_ops(ops);
+
 	sinfo->nskt = ops->nr;
 	sinfo->clk = clk;
 
@@ -327,15 +329,8 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
 			goto err1;
 	}
 
-	if (ret) {
-		while (--i >= 0)
-			soc_pcmcia_remove_one(&sinfo->skt[i]);
-		kfree(sinfo);
-		clk_put(clk);
-	} else {
-		pxa2xx_configure_sockets(&dev->dev);
-		dev_set_drvdata(&dev->dev, sinfo);
-	}
+	pxa2xx_configure_sockets(&dev->dev);
+	dev_set_drvdata(&dev->dev, sinfo);
 
 	return 0;
 
@@ -343,6 +338,7 @@ err1:
 	while (--i >= 0)
 		soc_pcmcia_remove_one(&sinfo->skt[i]);
 	kfree(sinfo);
+	clk_put(clk);
 err0:
 	return ret;
 }
-- 
1.7.4.1

  parent reply	other threads:[~2011-04-02  1:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-02  1:43 [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Marek Vasut
2011-04-02  1:43 ` [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c Marek Vasut
2011-04-04 10:45   ` Eric Miao
2011-04-04 12:06     ` Mark Brown
2011-04-04 12:33       ` Eric Miao
2011-04-04 12:44         ` Marek Vasut
2011-04-04 12:49           ` Russell King - ARM Linux
2011-04-04 12:52             ` Marek Vasut
2011-04-04 12:59             ` Russell King - ARM Linux
2011-04-10  7:58     ` Pavel Machek
2011-04-02  1:43 ` Marek Vasut [this message]
2011-04-03 13:18 ` [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301708597-7413-3-git-send-email-marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).