All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Samuel Ortiz" <sameo@linux.intel.com>
Subject: [PATCH] mfd: Move error handling to the end of mc13xxx_probe
Date: Mon, 03 Jan 2011 17:36:59 +0800	[thread overview]
Message-ID: <1294047419.25173.2.camel@mola> (raw)

To improve readability, move error handling to the end of mc13xxx_probe.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mfd/mc13xxx-core.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index b9fcaf0..18c29fc 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -732,28 +732,21 @@ static int mc13xxx_probe(struct spi_device *spi)
 
 	ret = mc13xxx_identify(mc13xxx, &id);
 	if (ret || id == MC13XXX_ID_INVALID)
-		goto err_revision;
+		goto err;
 
 	/* mask all irqs */
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK0, 0x00ffffff);
 	if (ret)
-		goto err_mask;
+		goto err;
 
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK1, 0x00ffffff);
 	if (ret)
-		goto err_mask;
+		goto err;
 
 	ret = request_threaded_irq(spi->irq, NULL, mc13xxx_irq_thread,
 			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);
-
-	if (ret) {
-err_mask:
-err_revision:
-		mc13xxx_unlock(mc13xxx);
-		dev_set_drvdata(&spi->dev, NULL);
-		kfree(mc13xxx);
-		return ret;
-	}
+	if (ret)
+		goto err;
 
 	mc13xxx_unlock(mc13xxx);
 
@@ -785,6 +778,11 @@ err_revision:
 	}
 
 	return 0;
+err:
+	mc13xxx_unlock(mc13xxx);
+	dev_set_drvdata(&spi->dev, NULL);
+	kfree(mc13xxx);
+	return ret;
 }
 
 static int __devexit mc13xxx_remove(struct spi_device *spi)
-- 
1.7.2




             reply	other threads:[~2011-01-03  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-03  9:36 Axel Lin [this message]
2011-01-03 20:05 ` [PATCH] mfd: Move error handling to the end of mc13xxx_probe Uwe Kleine-König

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=1294047419.25173.2.camel@mola \
    --to=axel.lin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.