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>
This commit is contained in:
Родитель
4a428bf3d9
Коммит
debf6d843e
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче