From: Wolfram Sang <w.sang@pengutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Wolfram Sang <w.sang@pengutronix.de>,
Grant Likely <grant.likely@secretlab.ca>
Subject: [PATCH 2/2] gpio: pca953x: propagate the errno from the chip_init functions
Date: Fri, 14 Oct 2011 15:32:00 +0200 [thread overview]
Message-ID: <1318599120-413-2-git-send-email-w.sang@pengutronix.de> (raw)
In-Reply-To: <1318599120-413-1-git-send-email-w.sang@pengutronix.de>
Initializing the chips may return with an error, but this error gets
dropped in probe(). Propagate this further to the driver core. Also,
simplify returning the error in one of the init functions.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
drivers/gpio/gpio-pca953x.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 45de6a4..a3fef0c 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -595,9 +595,6 @@ static int __devinit device_pca953x_init(struct pca953x_chip *chip, int invert)
/* set platform specific polarity inversion */
ret = pca953x_write_reg(chip, PCA953X_INVERT, invert);
- if (ret)
- goto out;
- return 0;
out:
return ret;
}
@@ -639,7 +636,7 @@ static int __devinit pca953x_probe(struct i2c_client *client,
struct pca953x_platform_data *pdata;
struct pca953x_chip *chip;
int irq_base=0, invert=0;
- int ret = 0;
+ int ret;
chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
if (chip == NULL)
@@ -672,9 +669,11 @@ static int __devinit pca953x_probe(struct i2c_client *client,
pca953x_setup_gpio(chip, id->driver_data & PCA_GPIO_MASK);
if (chip->chip_type == PCA953X_TYPE)
- device_pca953x_init(chip, invert);
+ ret = device_pca953x_init(chip, invert);
else
- device_pca957x_init(chip, invert);
+ ret = device_pca957x_init(chip, invert);
+ if (ret)
+ goto out_failed;
ret = pca953x_irq_setup(chip, id, irq_base);
if (ret)
--
1.7.6.3
next prev parent reply other threads:[~2011-10-14 13:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 13:31 [PATCH 1/2] gpio: pca953x: remove unneeded check for chip type Wolfram Sang
2011-10-14 13:32 ` Wolfram Sang [this message]
2011-10-29 6:58 ` Wolfram Sang
2011-10-29 10:26 ` Grant Likely
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=1318599120-413-2-git-send-email-w.sang@pengutronix.de \
--to=w.sang@pengutronix.de \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®