Skip to contentSkip to conversation

iio: accel: mma9551: Check gpiod_to_irq return value

PATCH Applied Roberta Dobrescu 6 participants 9 messages Mar 2, 2015 – Mar 9, 2015 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

	ret = gpiod_to_irq(gpio);

	dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

	return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +5 -1
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
 		if (ret)
 			return ret;
 
-		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,
Signature · 1 line
1.9.1
#1 lore raw
Quoted 17 lines · Roberta Dobrescu

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.

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

Quoted 7 lines

<code>

	ret = gpiod_to_irq(gpio);

	dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

	return ret;

</code>

Only slightly related, but why are these drivers even using GPIOs to get the IRQs. As far as I can see the GPIOs are not used otherwise in which case they should rather request the IRQ directly than going making the detour via the GPIO.

- Lars

maintainer
#2 lore raw
Quoted 23 lines · Lars-Peter Clausen
Quoted 22 lines · Roberta Dobrescu

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.

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

    ret = gpiod_to_irq(gpio);

    dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
Quoted 7 lines
Quoted 2 lines
    return ret;

</code>

Only slightly related, but why are these drivers even using GPIOs to get the IRQs. As far as I can see the GPIOs are not used otherwise in which case they should rather request the IRQ directly than going making the detour via the GPIO.

My understanding of this is that it's down to the ACPI provided data which gives us a gpio rather than the more correct irqs. I don't know if there is a simple way of avoiding this silliness and getting the irq directly. We keep ending up with the same bit of code so certainly feels like there should be (whatever ACPI itself is providing).

Jonathan

Quoted 7 lines

- Lars

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to Roberta Dobrescu
Quoted 40 lines · Roberta Dobrescu

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.

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

        ret = gpiod_to_irq(gpio);

        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

        return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +0 -0
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
                if (ret)
                        return ret;
 

drivers/iio/accel/mma9551.c static int mma9551_gpio_probe(struct iio_dev *indio_dev)

Quoted 10 lines
drivers/iio/accel/mma9551.c +5 -2
-               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,
--

+ Uwe

#4 lore raw

Hello,

Quoted 5 lines · Daniel Baluta
Quoted 3 lines · Roberta Dobrescu

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.

nothing really bad should happen because request_irq with a negative irq parameter just returns an error I think. So it's not urgent, but still a good idea to fix.

Quoted 2 lines
Quoted 2 lines

It's good habit to point out the commit that introduced the problem. In this case this would be:

Fixes c78b91716340 ("iio: add driver for Freescale MMA9551L")
Quoted 14 lines
Quoted 14 lines

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

        ret = gpiod_to_irq(gpio);
Quoted 8 lines
Quoted 8 lines
        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

        return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

Still worth fixing, isn't it? Also the error isn't handled, but ignored, like:

	if (client->irq <= 0)
		client->irq = sx9500_gpio_probe(client, data);

	if (client->irq > 0) {
		ret = devm_request_threaded_irq(....

but if an irq is specified (be it by means of a "normal" irq or by specifying a gpio in the device tree/acpi tables) I expect the driver to fail probing instead of just behaving as if no irq would be available. I don't know how this was tested, but I wonder further about

	#define SX9500_GPIO_NAME                "sx9500_gpio"
	...
	devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);

If I understand the code correctly that is supposed to look for "sx9500_gpio-gpio" in the ACPI data. Is this really correct?

Quoted 11 lines
Quoted 11 lines
 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +0 -0
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
                if (ret)
                        return ret;
 
Quoted 4 lines

drivers/iio/accel/mma9551.c static int mma9551_gpio_probe(struct iio_dev *indio_dev) · line 433

Quoted 4 lines
drivers/iio/accel/mma9551.c +3 -1
-               data->irqs[i] = gpiod_to_irq(gpio);
+               ret = gpiod_to_irq(gpio);
+               if (ret < 0)
+                       return ret;

I wonder if you should handle 0 as error, too. But even as is:

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#5 lore raw
Quoted 50 lines · Uwe Kleine-König

Hello,

Quoted 5 lines · Daniel Baluta
Quoted 3 lines · Roberta Dobrescu

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.

nothing really bad should happen because request_irq with a negative irq parameter just returns an error I think. So it's not urgent, but still a good idea to fix.

Quoted 2 lines
Quoted 2 lines

It's good habit to point out the commit that introduced the problem. In this case this would be:

Fixes c78b91716340 ("iio: add driver for Freescale MMA9551L")
Quoted 14 lines
Quoted 14 lines

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

        ret = gpiod_to_irq(gpio);
Quoted 8 lines
Quoted 8 lines
        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

        return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

Still worth fixing, isn't it? Also the error isn't handled, but ignored, like:

	if (client->irq <= 0)
		client->irq = sx9500_gpio_probe(client, data);

	if (client->irq > 0) {
		ret = devm_request_threaded_irq(....
Quoted 3 lines

but if an irq is specified (be it by means of a "normal" irq or by specifying a gpio in the device tree/acpi tables) I expect the driver to fail probing instead of just behaving as if no irq would be available.

If there is no IRQ available this device would still be able to do raw reads, although I admit I have not tested this.

Quoted 8 lines

I don't know how this was tested, but I wonder further about

	#define SX9500_GPIO_NAME                "sx9500_gpio"
	...
	devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);

If I understand the code correctly that is supposed to look for "sx9500_gpio-gpio" in the ACPI data. Is this really correct?

I'm in the process of changing this, will post some patches soon. This should include failing to probe if an IRQ is not found.

At the time I wrote the driver, I wasn't using Device Tree and ACPI had no support for _DSD (or at least I wasn't aware of it), so the name did not matter, only the index.

Thanks for the

Quoted 25 lines
Quoted 11 lines
Quoted 11 lines
 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +0 -0
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
                if (ret)
                        return ret;
 
Quoted 4 lines

drivers/iio/accel/mma9551.c static int mma9551_gpio_probe(struct iio_dev *indio_dev) · line 433

Quoted 4 lines
drivers/iio/accel/mma9551.c +3 -1
-               data->irqs[i] = gpiod_to_irq(gpio);
+               ret = gpiod_to_irq(gpio);
+               if (ret < 0)
+                       return ret;

I wonder if you should handle 0 as error, too. But even as is:

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
maintainer
#6 lore raw
Quoted 13 lines · Vlad Dogaru
Quoted 12 lines · Uwe Kleine-König

Hello,

Quoted 5 lines · Daniel Baluta
Quoted 3 lines · Roberta Dobrescu

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.

nothing really bad should happen because request_irq with a negative irq parameter just returns an error I think. So it's not urgent, but still a good idea to fix.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

It's good habit to point out the commit that introduced the problem. In this case this would be:

Fixes c78b91716340 ("iio: add driver for Freescale MMA9551L")

Vlad, do you want to respin taking the comments into account, or as Uwe put it, it's worth having as is so should I consider it as it stands?

Jonathan

Quoted 82 lines
Quoted 32 lines
Quoted 15 lines
Quoted 15 lines

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

        ret = gpiod_to_irq(gpio);
Quoted 8 lines
Quoted 8 lines
        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

        return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

Still worth fixing, isn't it? Also the error isn't handled, but ignored, like:

	if (client->irq <= 0)
		client->irq = sx9500_gpio_probe(client, data);

	if (client->irq > 0) {
		ret = devm_request_threaded_irq(....
Quoted 3 lines

but if an irq is specified (be it by means of a "normal" irq or by specifying a gpio in the device tree/acpi tables) I expect the driver to fail probing instead of just behaving as if no irq would be available.

If there is no IRQ available this device would still be able to do raw reads, although I admit I have not tested this.

Quoted 8 lines

I don't know how this was tested, but I wonder further about

	#define SX9500_GPIO_NAME                "sx9500_gpio"
	...
	devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);

If I understand the code correctly that is supposed to look for "sx9500_gpio-gpio" in the ACPI data. Is this really correct?

I'm in the process of changing this, will post some patches soon. This should include failing to probe if an IRQ is not found.

At the time I wrote the driver, I wasn't using Device Tree and ACPI had no support for _DSD (or at least I wasn't aware of it), so the name did not matter, only the index.

Thanks for the

Quoted 25 lines
Quoted 11 lines
Quoted 11 lines
 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +0 -0
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
                if (ret)
                        return ret;
 
Quoted 4 lines

drivers/iio/accel/mma9551.c static int mma9551_gpio_probe(struct iio_dev *indio_dev) · line 433

Quoted 4 lines
drivers/iio/accel/mma9551.c +3 -1
-               data->irqs[i] = gpiod_to_irq(gpio);
+               ret = gpiod_to_irq(gpio);
+               if (ret < 0)
+                       return ret;

I wonder if you should handle 0 as error, too. But even as is:

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Acked-by
#7 lore raw
Quoted 14 lines · Jonathan Cameron
Quoted 13 lines · Vlad Dogaru
Quoted 12 lines · Uwe Kleine-König

Hello,

Quoted 5 lines · Daniel Baluta
Quoted 3 lines · Roberta Dobrescu

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.

nothing really bad should happen because request_irq with a negative irq parameter just returns an error I think. So it's not urgent, but still a good idea to fix.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

It's good habit to point out the commit that introduced the problem. In this case this would be:

Fixes c78b91716340 ("iio: add driver for Freescale MMA9551L")

Vlad, do you want to respin taking the comments into account, or as Uwe put it, it's worth having as is so should I consider it as it stands?

I got slightly confused in my previous mail because the code was pasted from the sx9500 driver. That's the one I said I was working on.

The original mma9551 patch looks good as it is, please apply it.

Thanks,
Vlad

Quoted 83 lines
Quoted 82 lines
Quoted 32 lines
Quoted 15 lines
Quoted 15 lines

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

        ret = gpiod_to_irq(gpio);
Quoted 8 lines
Quoted 8 lines
        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

        return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

Still worth fixing, isn't it? Also the error isn't handled, but ignored, like:

	if (client->irq <= 0)
		client->irq = sx9500_gpio_probe(client, data);

	if (client->irq > 0) {
		ret = devm_request_threaded_irq(....
Quoted 3 lines

but if an irq is specified (be it by means of a "normal" irq or by specifying a gpio in the device tree/acpi tables) I expect the driver to fail probing instead of just behaving as if no irq would be available.

If there is no IRQ available this device would still be able to do raw reads, although I admit I have not tested this.

Quoted 8 lines

I don't know how this was tested, but I wonder further about

	#define SX9500_GPIO_NAME                "sx9500_gpio"
	...
	devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);

If I understand the code correctly that is supposed to look for "sx9500_gpio-gpio" in the ACPI data. Is this really correct?

I'm in the process of changing this, will post some patches soon. This should include failing to probe if an IRQ is not found.

At the time I wrote the driver, I wasn't using Device Tree and ACPI had no support for _DSD (or at least I wasn't aware of it), so the name did not matter, only the index.

Thanks for the

Quoted 25 lines
Quoted 11 lines
Quoted 11 lines
 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +0 -0
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
                if (ret)
                        return ret;
 
Quoted 4 lines

drivers/iio/accel/mma9551.c static int mma9551_gpio_probe(struct iio_dev *indio_dev) · line 433

Quoted 4 lines
drivers/iio/accel/mma9551.c +3 -1
-               data->irqs[i] = gpiod_to_irq(gpio);
+               ret = gpiod_to_irq(gpio);
+               if (ret < 0)
+                       return ret;

I wonder if you should handle 0 as error, too. But even as is:

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
maintainer Applied
#8 lore raw
Quoted 27 lines · Vlad Dogaru
Quoted 14 lines · Jonathan Cameron
Quoted 13 lines · Vlad Dogaru
Quoted 12 lines · Uwe Kleine-König

Hello,

Quoted 5 lines · Daniel Baluta
Quoted 3 lines · Roberta Dobrescu

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.

nothing really bad should happen because request_irq with a negative irq parameter just returns an error I think. So it's not urgent, but still a good idea to fix.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

It's good habit to point out the commit that introduced the problem. In this case this would be:

Fixes c78b91716340 ("iio: add driver for Freescale MMA9551L")

Vlad, do you want to respin taking the comments into account, or as Uwe put it, it's worth having as is so should I consider it as it stands?

I got slightly confused in my previous mail because the code was pasted from the sx9500 driver. That's the one I said I was working on.

Quoted 7 lines

The original mma9551 patch looks good as it is, please apply it.

Thanks,
Vlad

And you managed to confused me in turn :)

Anyhow, applied with the reviewed-by you'd already given it.

Applied to the togreg branch of iio.git
Shortly to be pushed out as testing for the autobuilders to play.

Jonathan

Quoted 83 lines
Quoted 83 lines
Quoted 82 lines
Quoted 32 lines
Quoted 15 lines
Quoted 15 lines

---
gpiod_to_irq also appears in the following drivers:
* drivers/iio/accel/bmc150-accel.c
* drivers/iio/accel/kxcjk-1013.c
* drivers/iio/accel/mma9553.c
* drivers/iio/gyro/bmg160.c
* drivers/iio/imu/kmx61.c
* drivers/iio/proximity/sx9500.c,

something like this:

<code>

        ret = gpiod_to_irq(gpio);
Quoted 8 lines
Quoted 8 lines
        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);

        return ret;

</code>

The return value of the functions containing the above code is checked, so the only problem would be that the debug message would contain a wrong value for irq in case gpiod_to_irq fails. So it doesn't affects much.

Still worth fixing, isn't it? Also the error isn't handled, but ignored, like:

	if (client->irq <= 0)
		client->irq = sx9500_gpio_probe(client, data);

	if (client->irq > 0) {
		ret = devm_request_threaded_irq(....
Quoted 3 lines

but if an irq is specified (be it by means of a "normal" irq or by specifying a gpio in the device tree/acpi tables) I expect the driver to fail probing instead of just behaving as if no irq would be available.

If there is no IRQ available this device would still be able to do raw reads, although I admit I have not tested this.

Quoted 8 lines

I don't know how this was tested, but I wonder further about

	#define SX9500_GPIO_NAME                "sx9500_gpio"
	...
	devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);

If I understand the code correctly that is supposed to look for "sx9500_gpio-gpio" in the ACPI data. Is this really correct?

I'm in the process of changing this, will post some patches soon. This should include failing to probe if an IRQ is not found.

At the time I wrote the driver, I wasn't using Device Tree and ACPI had no support for _DSD (or at least I wasn't aware of it), so the name did not matter, only the index.

Thanks for the

Quoted 25 lines
Quoted 11 lines
Quoted 11 lines
 drivers/iio/accel/mma9551.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/accel/mma9551.c +0 -0
index 46c3835..b6f3041 100644
@@ -428,7 +428,11 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev)
                if (ret)
                        return ret;
 
Quoted 4 lines

drivers/iio/accel/mma9551.c static int mma9551_gpio_probe(struct iio_dev *indio_dev) · line 433

Quoted 4 lines
drivers/iio/accel/mma9551.c +3 -1
-               data->irqs[i] = gpiod_to_irq(gpio);
+               ret = gpiod_to_irq(gpio);
+               if (ret < 0)
+                       return ret;

I wonder if you should handle 0 as error, too. But even as is:

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |