All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging:iio:light:tsl2x7x: fix the error handling in tsl2x7x_probe()
@ 2013-05-07 11:51 Wei Yongjun
  2013-05-11  9:50 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2013-05-07 11:51 UTC (permalink / raw)
  To: jic23, gregkh, lars, wfp5p, pmeerw; +Cc: yongjun_wei, linux-iio, devel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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>
---
 drivers/staging/iio/light/tsl2x7x_core.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index d060f25..c99f890 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;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging:iio:light:tsl2x7x: fix the error handling in tsl2x7x_probe()
  2013-05-07 11:51 [PATCH] staging:iio:light:tsl2x7x: fix the error handling in tsl2x7x_probe() Wei Yongjun
@ 2013-05-11  9:50 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2013-05-11  9:50 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: gregkh, lars, wfp5p, pmeerw, yongjun_wei, linux-iio, devel

On 05/07/2013 12:51 PM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> 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>
Applied to fixes-togreg branch of iio.git
Thanks,
> ---
>  drivers/staging/iio/light/tsl2x7x_core.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
> index d060f25..c99f890 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;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-11  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07 11:51 [PATCH] staging:iio:light:tsl2x7x: fix the error handling in tsl2x7x_probe() Wei Yongjun
2013-05-11  9:50 ` Jonathan Cameron

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.