From debf6d843eaa3622786c45eb6edbc46f38f31a90 Mon Sep 17 00:00:00 2001 From: Roberta Dobrescu Date: Mon, 2 Mar 2015 12:39:12 +0200 Subject: [PATCH] iio: accel: mma9551: Check gpiod_to_irq return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Vlad Dogaru Acked-by: Uwe Kleine-König Signed-off-by: Jonathan Cameron --- 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 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, -- 2.39.5