aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-05-07 07:51:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-05-22 17:14:57 -0400
commit3b813798aa7030f1beef638c75f8b0008f737a82 (patch)
treeafd9b9ada9534d168a83c2b081000a3f26661073
parentc80712c793febdf1b13ad0e1c71a051e071b3fd8 (diff)
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>
-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 d060f2572512..c99f890cc6c6 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,
1869 dev_info(&chip->client->dev, 1869 dev_info(&chip->client->dev,
1870 "%s: i2c device found does not match expected id\n", 1870 "%s: i2c device found does not match expected id\n",
1871 __func__); 1871 __func__);
1872 ret = -EINVAL;
1872 goto fail1; 1873 goto fail1;
1873 } 1874 }
1874 1875
@@ -1907,7 +1908,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
1907 if (ret) { 1908 if (ret) {
1908 dev_err(&clientp->dev, 1909 dev_err(&clientp->dev,
1909 "%s: irq request failed", __func__); 1910 "%s: irq request failed", __func__);
1910 goto fail2; 1911 goto fail1;
1911 } 1912 }
1912 } 1913 }
1913 1914
@@ -1920,17 +1921,17 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
1920 if (ret) { 1921 if (ret) {
1921 dev_err(&clientp->dev, 1922 dev_err(&clientp->dev,
1922 "%s: iio registration failed\n", __func__); 1923 "%s: iio registration failed\n", __func__);
1923 goto fail1; 1924 goto fail2;
1924 } 1925 }
1925 1926
1926 dev_info(&clientp->dev, "%s Light sensor found.\n", id->name); 1927 dev_info(&clientp->dev, "%s Light sensor found.\n", id->name);
1927 1928
1928 return 0; 1929 return 0;
1929 1930
1930fail1: 1931fail2:
1931 if (clientp->irq) 1932 if (clientp->irq)
1932 free_irq(clientp->irq, indio_dev); 1933 free_irq(clientp->irq, indio_dev);
1933fail2: 1934fail1:
1934 iio_device_free(indio_dev); 1935 iio_device_free(indio_dev);
1935 1936
1936 return ret; 1937 return ret;