diff mbox series

[1/3] iio: trigger: Fix platform_get_irq's error checking

Message ID 1512056616-21065-2-git-send-email-arvind.yadav.cs@gmail.com
State Not Applicable, archived
Delegated to: David Miller
Headers show
Series Handle return value of platform_get_irq | expand

Commit Message

Arvind Yadav Nov. 30, 2017, 3:43 p.m. UTC
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron Dec. 2, 2017, 12:22 p.m. UTC | #1
On Thu, 30 Nov 2017 21:13:34 +0530
Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:

> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Applied to the togreg branch of iio.git.  This is probably just
a theoretical problem as obviously the blackfin trigger only runs
on blackfin boards and I assume they only return 0.

Anyhow, nothing wrong with tidying it up as might possible get
cut and paste to somewhere it does matter in future!

Jonathan

> ---
>  drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> index d80dcf8..f389f5c 100644
> --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> @@ -187,9 +187,9 @@ static int iio_bfin_tmr_trigger_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	st->irq = platform_get_irq(pdev, 0);
> -	if (!st->irq) {
> +	if (st->irq < 0) {
>  		dev_err(&pdev->dev, "No IRQs specified");
> -		return -ENODEV;
> +		return st->irq;
>  	}
>  
>  	ret = iio_bfin_tmr_get_number(st->irq);
diff mbox series

Patch

diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
index d80dcf8..f389f5c 100644
--- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
+++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
@@ -187,9 +187,9 @@  static int iio_bfin_tmr_trigger_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	st->irq = platform_get_irq(pdev, 0);
-	if (!st->irq) {
+	if (st->irq < 0) {
 		dev_err(&pdev->dev, "No IRQs specified");
-		return -ENODEV;
+		return st->irq;
 	}
 
 	ret = iio_bfin_tmr_get_number(st->irq);