Skip to contentSkip to conversation

iio: light: tsl2591: return actual error from probe IRQ failure

PATCH Superseded Stepan Ionichev 4 participants 10 messages May 17 – Jul 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: light: tsl2591: return actual error from probe IRQ failure

When devm_request_threaded_irq() fails, probe calls dev_err_probe() but then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow that dev_err_probe() handles for -EPROBE_DEFER.

Return the value from dev_err_probe() instead.

Fixes 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")
---
 drivers/iio/light/tsl2591.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tsl2591.c +2 -4
index c5557867e..4b0a2a302 100644
@@ -1137,10 +1137,8 @@ static int tsl2591_probe(struct i2c_client *client)
 						NULL, tsl2591_event_handler,
 						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 						"tsl2591_irq", indio_dev);
-		if (ret) {
-			dev_err_probe(&client->dev, ret, "IRQ request error\n");
-			return -EINVAL;
-		}
+		if (ret)
+			return dev_err_probe(&client->dev, ret, "IRQ request error\n");
 		indio_dev->info = &tsl2591_info;
 	} else {
 		indio_dev->info = &tsl2591_info_no_irq;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Stepan Ionichev

When devm_request_threaded_irq() fails, probe calls dev_err_probe() but then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow that dev_err_probe() handles for -EPROBE_DEFER.

Return the value from dev_err_probe() instead.

Fixes 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")

Fine by me. Maybe this could also get marked for stable? (Up to Jonathan of course).

Signature · 3 lines
Kind regards

CJD
#2 lore raw
In reply to Stepan Ionichev
Quoted 5 lines · Stepan Ionichev

When devm_request_threaded_irq() fails, probe calls dev_err_probe() but then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow that dev_err_probe() handles for -EPROBE_DEFER.

Return the value from dev_err_probe() instead.

...

drivers/iio/light/tsl2591.c static int tsl2591_probe(struct i2c_client *client) · line 1141

Quoted 6 lines
drivers/iio/light/tsl2591.c +2 -4
-		if (ret) {
-			dev_err_probe(&client->dev, ret, "IRQ request error\n");
-			return -EINVAL;
-		}
+		if (ret)
+			return dev_err_probe(&client->dev, ret, "IRQ request error\n");

Also remove dup message, at the end it should be

		if (ret)
			return ret;
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH v2 1/1 iio: light: tsl2591: return actual error from probe IRQ failure

In reply to Stepan Ionichev

When devm_request_threaded_irq() fails, probe logs the error and then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow for -EPROBE_DEFER.

Return ret directly; the IRQ subsystem already prints on failure.

Fixes 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")

---
v2:
- Drop dev_err_probe(); just return ret (Andy)
- Add Cc: stable@ as suggested by Joshua

v1: https://lore.kernel.org/all/[email protected]/

 drivers/iio/light/tsl2591.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tsl2591.c +2 -4
index c5557867e..c5ccd833d 100644
@@ -1137,10 +1137,8 @@ static int tsl2591_probe(struct i2c_client *client)
 						NULL, tsl2591_event_handler,
 						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 						"tsl2591_irq", indio_dev);
-		if (ret) {
-			dev_err_probe(&client->dev, ret, "IRQ request error\n");
-			return -EINVAL;
-		}
+		if (ret)
+			return ret;
 		indio_dev->info = &tsl2591_info;
 	} else {
 		indio_dev->info = &tsl2591_info_no_irq;
Signature · 1 line
2.43.0
maintainer Applied
#4 lore raw
Quoted 7 lines · On Mon, 18 May 2026 14:43:11 +0500 Stepan Ionichev <[email protected]> wrote:

When devm_request_threaded_irq() fails, probe logs the error and then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow for -EPROBE_DEFER.

Return ret directly; the IRQ subsystem already prints on failure.

Fixes 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")

Hmm. To me borderline on whether it's a fix. In theory a board may exist where the defer is a possibility. In practice probably not given I don't think we've ever had a report of this.

Meh, it's harmless enough and maybe helps someone.

Quoted 2 lines

New series versions should never be in reply to older series.

It tends to hide them in people's inboxes and brings little nor no benefit.

Quoted 4 lines

---
v2:
- Drop dev_err_probe(); just return ret (Andy)
- Add Cc: stable@ as suggested by Joshua

Mostly for IIO I add those to patches that I think need it but don't object if people feel strongly enough and add them themselves.

Applied to the iio-fixes branch of iio.git.

Quoted 23 lines

v1: https://lore.kernel.org/all/[email protected]/

 drivers/iio/light/tsl2591.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tsl2591.c +2 -4
index c5557867e..c5ccd833d 100644
@@ -1137,10 +1137,8 @@ static int tsl2591_probe(struct i2c_client *client)
 						NULL, tsl2591_event_handler,
 						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 						"tsl2591_irq", indio_dev);
-		if (ret) {
-			dev_err_probe(&client->dev, ret, "IRQ request error\n");
-			return -EINVAL;
-		}
+		if (ret)
+			return ret;
 		indio_dev->info = &tsl2591_info;
 	} else {
 		indio_dev->info = &tsl2591_info_no_irq;
maintainer
#5 lore raw
Quoted 22 lines · On Mon, 18 May 2026 16:40:48 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 7 lines · On Mon, 18 May 2026 14:43:11 +0500 Stepan Ionichev <[email protected]> wrote:

When devm_request_threaded_irq() fails, probe logs the error and then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow for -EPROBE_DEFER.

Return ret directly; the IRQ subsystem already prints on failure.

Fixes 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")

Hmm. To me borderline on whether it's a fix. In theory a board may exist where the defer is a possibility. In practice probably not given I don't think we've ever had a report of this.

Meh, it's harmless enough and maybe helps someone.

Quoted 2 lines

New series versions should never be in reply to older series.

It tends to hide them in people's inboxes and brings little nor no benefit.

Quoted 9 lines
Quoted 4 lines

---
v2:
- Drop dev_err_probe(); just return ret (Andy)
- Add Cc: stable@ as suggested by Joshua

Mostly for IIO I add those to patches that I think need it but don't object if people feel strongly enough and add them themselves.

Applied to the iio-fixes branch of iio.git.

Actually dropped again. I forgot to check sashiko and it raises a reasonable question:
https://sashiko.dev/#/patchset/20260518094311.2000-1-sozdayvek%40gmail.com

Does completely removing dev_err_probe() here drop the deferred probe reason tracking?
While this patch successfully fixes the return code, dev_err_probe() also records the deferral reason in debugfs via device_set_deferred_probe_reason() when ret is -EPROBE_DEFER.
Could we keep the diagnostic tracking by returning the result of dev_err_probe() directly instead?

        if (ret)
                return dev_err_probe(&client->dev, ret, "IRQ request error\n");

Andy, what do you think?

Quoted 24 lines
Quoted 23 lines

v1: https://lore.kernel.org/all/[email protected]/

 drivers/iio/light/tsl2591.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tsl2591.c +2 -4
index c5557867e..c5ccd833d 100644
@@ -1137,10 +1137,8 @@ static int tsl2591_probe(struct i2c_client *client)
 						NULL, tsl2591_event_handler,
 						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 						"tsl2591_irq", indio_dev);
-		if (ret) {
-			dev_err_probe(&client->dev, ret, "IRQ request error\n");
-			return -EINVAL;
-		}
+		if (ret)
+			return ret;
 		indio_dev->info = &tsl2591_info;
 	} else {
 		indio_dev->info = &tsl2591_info_no_irq;  
maintainer
#6 lore raw
Quoted 45 lines · On Mon, 18 May 2026 16:43:09 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 22 lines · On Mon, 18 May 2026 16:40:48 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 7 lines · On Mon, 18 May 2026 14:43:11 +0500 Stepan Ionichev <[email protected]> wrote:

When devm_request_threaded_irq() fails, probe logs the error and then returns -EINVAL, dropping the real error code and breaking the deferred-probe flow for -EPROBE_DEFER.

Return ret directly; the IRQ subsystem already prints on failure.

Fixes 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")

Hmm. To me borderline on whether it's a fix. In theory a board may exist where the defer is a possibility. In practice probably not given I don't think we've ever had a report of this.

Meh, it's harmless enough and maybe helps someone.

Quoted 2 lines

New series versions should never be in reply to older series.

It tends to hide them in people's inboxes and brings little nor no benefit.

Quoted 9 lines
Quoted 4 lines

---
v2:
- Drop dev_err_probe(); just return ret (Andy)
- Add Cc: stable@ as suggested by Joshua

Mostly for IIO I add those to patches that I think need it but don't object if people feel strongly enough and add them themselves.

Applied to the iio-fixes branch of iio.git.

Actually dropped again. I forgot to check sashiko and it raises a reasonable question:
https://sashiko.dev/#/patchset/20260518094311.2000-1-sozdayvek%40gmail.com

Does completely removing dev_err_probe() here drop the deferred probe reason tracking?
While this patch successfully fixes the return code, dev_err_probe() also records the deferral reason in debugfs via device_set_deferred_probe_reason() when ret is -EPROBE_DEFER.
Could we keep the diagnostic tracking by returning the result of dev_err_probe() directly instead?

Quoted 4 lines
        if (ret)
                return dev_err_probe(&client->dev, ret, "IRQ request error\n");

Andy, what do you think?

Andy?

This is a change you might have asked for, but sashiko is correctly noting that we might loose a deferred reason even if the print is otherwise useless.

Jonathan

Quoted 27 lines
Quoted 25 lines
Quoted 24 lines

v1: https://lore.kernel.org/all/[email protected]/

 drivers/iio/light/tsl2591.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tsl2591.c +2 -4
index c5557867e..c5ccd833d 100644
@@ -1137,10 +1137,8 @@ static int tsl2591_probe(struct i2c_client *client)
 						NULL, tsl2591_event_handler,
 						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 						"tsl2591_irq", indio_dev);
-		if (ret) {
-			dev_err_probe(&client->dev, ret, "IRQ request error\n");
-			return -EINVAL;
-		}
+		if (ret)
+			return ret;
 		indio_dev->info = &tsl2591_info;
 	} else {
 		indio_dev->info = &tsl2591_info_no_irq;    
#7 lore raw
Quoted 4 lines · Jonathan Cameron
Quoted 2 lines · On Mon, 18 May 2026 16:43:09 +0100 Jonathan Cameron <[email protected]> wrote:

On Mon, 18 May 2026 16:40:48 +0100
Jonathan Cameron <[email protected]> wrote:

...

Quoted 12 lines
Quoted 12 lines

https://sashiko.dev/#/patchset/20260518094311.2000-1-sozdayvek%40gmail.com

Does completely removing dev_err_probe() here drop the deferred probe reason tracking?
While this patch successfully fixes the return code, dev_err_probe() also records the deferral reason in debugfs via device_set_deferred_probe_reason() when ret is -EPROBE_DEFER.
Could we keep the diagnostic tracking by returning the result of dev_err_probe() directly instead?

        if (ret)
                return dev_err_probe(&client->dev, ret, "IRQ request error\n");
Quoted 5 lines
Quoted 1 line

Andy, what do you think?

Andy?

This is a change you might have asked for, but sashiko is correctly noting that we might loose a deferred reason even if the print is otherwise useless.

Incorrectly. IRQ core prints an error via dev_err_probe(). Did I miss something?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Jonathan Cameron
Quoted 2 lines · On Mon, 18 May 2026 16:43:09 +0100 Jonathan Cameron <[email protected]> wrote:

On Mon, 18 May 2026 16:40:48 +0100
Jonathan Cameron <[email protected]> wrote:

...

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

https://sashiko.dev/#/patchset/20260518094311.2000-1-sozdayvek%40gmail.com

Does completely removing dev_err_probe() here drop the deferred probe reason tracking?
While this patch successfully fixes the return code, dev_err_probe() also records the deferral reason in debugfs via device_set_deferred_probe_reason() when ret is -EPROBE_DEFER.
Could we keep the diagnostic tracking by returning the result of dev_err_probe() directly instead?

        if (ret)
                return dev_err_probe(&client->dev, ret, "IRQ request error\n");
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Andy, what do you think?

Andy?

This is a change you might have asked for, but sashiko is correctly noting that we might loose a deferred reason even if the print is otherwise useless.

Incorrectly. IRQ core prints an error via dev_err_probe(). Did I miss something?

I'm referring to implementation of devm_request_result() in kernel/irq/devres.c.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#9 lore raw
Quoted 22 lines · On Thu, 4 Jun 2026 10:26:02 +0300 Andy Shevchenko…
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Jonathan Cameron
Quoted 2 lines · On Mon, 18 May 2026 16:43:09 +0100 Jonathan Cameron <[email protected]> wrote:

On Mon, 18 May 2026 16:40:48 +0100
Jonathan Cameron <[email protected]> wrote:

...

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

https://sashiko.dev/#/patchset/20260518094311.2000-1-sozdayvek%40gmail.com

Does completely removing dev_err_probe() here drop the deferred probe reason tracking?
While this patch successfully fixes the return code, dev_err_probe() also records the deferral reason in debugfs via device_set_deferred_probe_reason() when ret is -EPROBE_DEFER.
Could we keep the diagnostic tracking by returning the result of dev_err_probe() directly instead?

        if (ret)
                return dev_err_probe(&client->dev, ret, "IRQ request error\n");

Andy, what do you think?

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Andy?

This is a change you might have asked for, but sashiko is correctly noting that we might loose a deferred reason even if the print is otherwise useless.

Incorrectly. IRQ core prints an error via dev_err_probe(). Did I miss something?

I'm referring to implementation of devm_request_result() in kernel/irq/devres.c.

Oops. I almost lost this one. Patchwork had my back though.

Applied.

Jonathan