[PATCH] iio: accel: mma9551: Check gpiod_to_irq return value

Vlad Dogaru ddvlad at herebedragons.ro
Mon Mar 2 10:26:52 EET 2015


On Sat, Feb 28, 2015 at 05:31:25PM +0200, Roberta Dobrescu wrote:
> The return value of gpiod_to_irq should be checked before giving
> it to devm_request_threaded_irq in order to not pass an error
> code in case it fails.
> 
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu at gmail.com>

Reviewed-by: Vlad Dogaru <vlad.dogaru at intel.com>

> ---
>  drivers/iio/accel/mma9551.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c
> index 46c3835..b6f3041 100644
> --- a/drivers/iio/accel/mma9551.c
> +++ b/drivers/iio/accel/mma9551.c
> @@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
>  		if (ret)
>  			return ret;
>  
> -		data->irqs[i] = gpiod_to_irq(gpio);
> +		ret = gpiod_to_irq(gpio);
> +		if (ret < 0)
> +			return ret;
> +
> +		data->irqs[i] = ret;
>  		ret = devm_request_threaded_irq(dev, data->irqs[i],
>  				NULL, mma9551_event_handler,
>  				IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> -- 
> 1.9.1
> 
> 


More information about the firefly mailing list