From: Roberta Dobrescu Date: Mon, 2 Mar 2015 10:39:12 +0000 (+0200) Subject: iio: accel: mma9551: Check gpiod_to_irq return value X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=debf6d843eaa3622786c45eb6edbc46f38f31a90;p=linux-beck.git 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 Reviewed-by: Vlad Dogaru Acked-by: Uwe Kleine-König Signed-off-by: Jonathan Cameron --- 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,