[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100610054046.16716.54159.stgit@angua>
Date: Wed, 09 Jun 2010 23:40:46 -0600
From: Grant Likely <grant.likely@...retlab.ca>
To: dbrownell@...rs.sourceforge.net, avorontsov@...mvista.com
Cc: bgat@...lgatliff.com, dbaryshkov@...il.com,
benh@...nel.crashing.org, devicetree-discuss@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH v2 1/5] gpiolib: cosmetic improvements for error handling in
gpiochip_add()
From: Anton Vorontsov <avorontsov@...mvista.com>
Hopefully it makes the code look nicer and makes it easier to extend
this function.
Signed-off-by: Anton Vorontsov <avorontsov@...mvista.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@...retlab.ca>
CC: devicetree-discuss@...ts.ozlabs.org
CC: linux-kernel@...r.kernel.org
---
drivers/gpio/gpiolib.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3ca3654..713ca0e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1101,14 +1101,20 @@ int gpiochip_add(struct gpio_chip *chip)
unlock:
spin_unlock_irqrestore(&gpio_lock, flags);
- if (status == 0)
- status = gpiochip_export(chip);
+
+ if (status)
+ goto fail;
+
+ status = gpiochip_export(chip);
+ if (status)
+ goto fail;
+
+ return 0;
fail:
/* failures here can mean systems won't boot... */
- if (status)
- pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n",
- chip->base, chip->base + chip->ngpio - 1,
- chip->label ? : "generic");
+ pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n",
+ chip->base, chip->base + chip->ngpio - 1,
+ chip->label ? : "generic");
return status;
}
EXPORT_SYMBOL_GPL(gpiochip_add);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists