summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-05-07 12:51:00 +0100
committerJonathan Cameron <jic23@kernel.org>2013-05-22 22:14:57 +0100
commit3b813798aa7030f1beef638c75f8b0008f737a82 (patch)
treeafd9b9ada9534d168a83c2b081000a3f26661073 /drivers
parentc80712c793febdf1b13ad0e1c71a051e071b3fd8 (diff)
downloadlinux-3.10-3b813798aa7030f1beef638c75f8b0008f737a82.tar.gz
linux-3.10-3b813798aa7030f1beef638c75f8b0008f737a82.tar.bz2
linux-3.10-3b813798aa7030f1beef638c75f8b0008f737a82.zip
staging:iio:light:tsl2x7x: fix the error handling in tsl2x7x_probe()
Fix to return -EINVAL in the i2c device found error handling case instead of 0, as done elsewhere in this function. And also correct the fail1 and fail2 lable to do the right thing. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/iio/light/tsl2x7x_core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index d060f257251..c99f890cc6c 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1869,6 +1869,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
dev_info(&chip->client->dev,
"%s: i2c device found does not match expected id\n",
__func__);
+ ret = -EINVAL;
goto fail1;
}
@@ -1907,7 +1908,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
if (ret) {
dev_err(&clientp->dev,
"%s: irq request failed", __func__);
- goto fail2;
+ goto fail1;
}
}
@@ -1920,17 +1921,17 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
if (ret) {
dev_err(&clientp->dev,
"%s: iio registration failed\n", __func__);
- goto fail1;
+ goto fail2;
}
dev_info(&clientp->dev, "%s Light sensor found.\n", id->name);
return 0;
-fail1:
+fail2:
if (clientp->irq)
free_irq(clientp->irq, indio_dev);
-fail2:
+fail1:
iio_device_free(indio_dev);
return ret;