Skip to content

Commit

Permalink
iio: accel: mma9551: Check gpiod_to_irq return value
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Vlad Dogaru <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
robertaDobrescu authored and jic23 committed Mar 9, 2015
1 parent 4a428bf commit debf6d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/iio/accel/mma9551.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
return PTR_ERR(gpio);
}

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,
Expand Down

0 comments on commit debf6d8

Please sign in to comment.