diff options
author | Roberta Dobrescu <roberta.dobrescu@gmail.com> | 2015-03-02 12:39:12 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-03-09 13:27:49 +0000 |
commit | debf6d843eaa3622786c45eb6edbc46f38f31a90 (patch) | |
tree | 84d28209b44f288fb59e193e5e00f7ff0eb41db2 /drivers/iio/accel/mma9551.c | |
parent | 4a428bf3d92385f27cbb15bef90754027ba4f2d9 (diff) | |
download | linux-debf6d843eaa3622786c45eb6edbc46f38f31a90.tar.gz linux-debf6d843eaa3622786c45eb6edbc46f38f31a90.tar.bz2 linux-debf6d843eaa3622786c45eb6edbc46f38f31a90.zip |
iio: accel: mma9551: Check gpiod_to_irq return value
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@gmail.com>
Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel/mma9551.c')
-rw-r--r-- | drivers/iio/accel/mma9551.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c index 1277f407cd12..7db7cc0bf362 100644 --- a/drivers/iio/accel/mma9551.c +++ b/drivers/iio/accel/mma9551.c @@ -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, |