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 | |
parent | 4a428bf3d92385f27cbb15bef90754027ba4f2d9 (diff) | |
download | op-kernel-dev-debf6d843eaa3622786c45eb6edbc46f38f31a90.zip op-kernel-dev-debf6d843eaa3622786c45eb6edbc46f38f31a90.tar.gz |
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')
-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 1277f40..7db7cc0 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, |