Using dev_err_probe as it simplifies error handling and ensures consistent error reporting.
v2 cover Using dev_err_probe as it simplifies error handling and ensures consistent error reporting.
Errors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. This adds that missing log.
changes in v2:
- ti-adc084s021: drop unnecessary braces around single statement if block
v1: https://lore.kernel.org/linux-iio/[email protected]/
Prashant Rahul (5):
iio: adc: ti-adc081c: use dev_err_probe for probe time error
iio: adc: ti-adc084s021: use dev_err_probe for probe time error
iio: adc: ti-adc108s102: log buffer setup failure in probe
iio: adc: ti-adc161s626: log buffer setup failure in probe
iio: adc: ti-adc0832: log buffer setup failure in probe
drivers/iio/adc/ti-adc081c.c | 6 ++---- drivers/iio/adc/ti-adc0832.c | 2 +- drivers/iio/adc/ti-adc084s021.c | 6 ++---- drivers/iio/adc/ti-adc108s102.c | 2 +- drivers/iio/adc/ti-adc161s626.c | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-)
--
2.54.0
PATCH v2 1/5 iio: adc: ti-adc081c: use dev_err_probe for probe time error
This simplifies error handling and ensures consistent error reporting.
--- drivers/iio/adc/ti-adc081c.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc081c.c +2 -4
@@ -190,10 +190,8 @@ static int adc081c_probe(struct i2c_client *client) err =devm_iio_triggered_buffer_setup (&client->dev, iio,NULL , adc081c_trigger_handler,NULL ); -if (err <0 ) { -dev_err (&client->dev,"iio triggered buffer setup failed\n" ); -return err; - } +if (err <0 ) +return dev_err_probe (&client->dev, err,"iio triggered buffer setup failed\n" );return devm_iio_device_register (&client->dev, iio); }
Signature · 1 line
2.54.0
PATCH v2 2/5 iio: adc: ti-adc084s021: use dev_err_probe for probe time error
In reply to Prashant RahulThis simplifies error handling and ensures consistent error reporting.
--- drivers/iio/adc/ti-adc084s021.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc084s021.c +2 -4
@@ -229,10 +229,8 @@ static int adc084s021_probe(struct spi_device *spi) ret =devm_iio_triggered_buffer_setup (&spi->dev, indio_dev,NULL , adc084s021_buffer_trigger_handler, &adc084s021_buffer_setup_ops); -if (ret) { -dev_err (&spi->dev,"Failed to setup triggered buffer\n" ); -return ret; - } +if (ret) +return dev_err_probe (&spi->dev, ret,"Failed to setup triggered buffer\n" );return devm_iio_device_register (&spi->dev, indio_dev); }
Signature · 1 line
2.54.0
Re: [PATCH v2 2/5] iio: adc: ti-adc084s021: use dev_err_probe for probe time error
Quoted 1 line · Prashant Rahul
This simplifies error handling and ensures consistent error reporting.
...
Quoted 1 line
+++
b/drivers/iio/adc/ti-adc084s021.c
Side note: this also needs devm_mutex_init().
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 3/5 iio: adc: ti-adc108s102: log buffer setup failure in probe
In reply to Prashant RahulErrors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. Log the error returned by the buffer setup path as well.
--- drivers/iio/adc/ti-adc108s102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc108s102.c +1 -1
@@ -256,7 +256,7 @@ static int adc108s102_probe(struct spi_device *spi) &adc108s102_trigger_handler, NULL);if (ret) -return ret; +return dev_err_probe (&spi->dev, ret,"iio triggered buffer setup failed\n" ); ret =devm_iio_device_register (&spi->dev, indio_dev);if (ret)
Signature · 1 line
2.54.0
PATCH v2 4/5 iio: adc: ti-adc161s626: log buffer setup failure in probe
In reply to Prashant RahulErrors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. Log the error returned by the buffer setup path as well.
--- drivers/iio/adc/ti-adc161s626.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc161s626.c +1 -1
@@ -217,7 +217,7 @@ static int ti_adc_probe(struct spi_device *spi) ret =devm_iio_triggered_buffer_setup (&spi->dev, indio_dev,NULL , ti_adc_trigger_handler,NULL );if (ret) -return ret; +return dev_err_probe (&spi->dev, ret,"iio triggered buffer setup failed\n" );return devm_iio_device_register (&spi->dev, indio_dev); }
Signature · 1 line
2.54.0
Jonathan Cameron
maintainerRe: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 3 lines · On Sat, 20 Jun 2026 23:10:56 +0530 Prashant Rahul <[email protected]>…
Errors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. Log the error returned by the buffer setup path as well.
Why this particular one but not the devm_iio_device_register() below it? Both pretty much only fail on driver bugs. Or out of memory for which dev_err_probe() doesn't print anything anyway (on basis that is normally pretty noisy).
Quoted 19 lines
Signed-off-by Prashant Rahul <[email protected]>--- drivers/iio/adc/ti-adc161s626.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/adc/ti-adc161s626.c +1
-1@@ -217,7 +217,7 @@ static int ti_adc_probe(struct spi_device *spi) ret =devm_iio_triggered_buffer_setup (&spi->dev, indio_dev,NULL , ti_adc_trigger_handler,NULL );if (ret) -return ret; +return dev_err_probe (&spi->dev, ret,"iio triggered buffer setup failed\n" );return devm_iio_device_register (&spi->dev, indio_dev); }
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 10 lines · Jonathan Cameron
Quoted 3 lines · On Sat, 20 Jun 2026 23:10:56 +0530 Prashant Rahul <[email protected]>…
Errors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. Log the error returned by the buffer setup path as well.
Why this particular one but not the
devm_iio_device_register()below it? Both pretty much only fail on driver bugs. Or out of memory for whichdev_err_probe()doesn't print anything anyway (on basis that is normally pretty noisy).
For the record, I need to withdraw my tag as I haven't noticed that this series just adds tons of dead code (based on -ENOMEM returned value).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
In reply to Jonathan CameronQuoted 4 lines · Jonathan Cameron
Why this particular one but not the
devm_iio_device_register()below it? Both pretty much only fail on driver bugs. Or out of memory for whichdev_err_probe()doesn't print anything anyway (on basis that is normally pretty noisy).
My apologies, I wasnt aware that dev_err_probe simply ignores -ENOMEM. Looking at drivers/base/core.c:5096, it is pretty evident that it does.
My goal with the patch series was to change dev_err into dev_err_probe, as my understanding of dev_err_probe was that it's a specialization of dev_err for probe contexts.
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 6 lines · Prashant Rahul
Quoted 4 lines · Jonathan Cameron
Why this particular one but not the
devm_iio_device_register()below it? Both pretty much only fail on driver bugs. Or out of memory for whichdev_err_probe()doesn't print anything anyway (on basis that is normally pretty noisy).
Quoted 6 lines
My apologies, I wasnt aware that
dev_err_probesimply ignores-ENOMEM. Looking atdrivers/base/core.c:5096, it is pretty evident that it does.My goal with the patch series was to change
dev_errintodev_err_probe, as my understanding ofdev_err_probewas that it's a specialization ofdev_errfor probe contexts.
Jonathan, actually the triggered buffer setup might return not -ENOMEM error code for the surprise. After all this series does add not a dead code, but a quite rare to be used one.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 14 lines · On Wed, 24 Jun 2026 14:26:52 +0300 Andy Shevchenko…
Quoted 6 lines · Prashant Rahul
Quoted 4 lines · Jonathan Cameron
Why this particular one but not the
devm_iio_device_register()below it? Both pretty much only fail on driver bugs. Or out of memory for whichdev_err_probe()doesn't print anything anyway (on basis that is normally pretty noisy).Quoted 6 lines
My apologies, I wasnt aware that
dev_err_probesimply ignores-ENOMEM. Looking atdrivers/base/core.c:5096, it is pretty evident that it does.My goal with the patch series was to change
dev_errintodev_err_probe, as my understanding ofdev_err_probewas that it's a specialization ofdev_errfor probe contexts.
Quoted 7 lines
Jonathan, actually the triggered buffer setup might return not
-ENOMEMerror code for the surprise. After all this series does add not a dead code, but a quite rare to be used one.
Agreed and I'm not even sure why that is there (lost to the mists of time / my failing memory ;) However I think it's an obvious driver bug case that should be trivial to see in basic tests so to me it's marginal on whether a print on these is useful.
Maybe given that one is so rare we should just add a print in the core? I'm not particularly keen on mass patches to print errors from the core code but this one is perhaps a reasonable trade off vs series like this one adding prints to drivers for something we don't think realistically ever happens.
Jonathan
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 4 lines · Jonathan Cameron
Quoted 2 lines · On Wed, 24 Jun 2026 14:26:52 +0300 Andy Shevchenko…
Quoted 1 line · Prashant Rahul
On Wed Jun 24, 2026 at 1:06 AM IST, Jonathan Cameron wrote:
...
Quoted 23 lines
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
Why this particular one but not the
devm_iio_device_register()below it? Both pretty much only fail on driver bugs. Or out of memory for whichdev_err_probe()doesn't print anything anyway (on basis that is normally pretty noisy).My apologies, I wasnt aware that
dev_err_probesimply ignores-ENOMEM. Looking atdrivers/base/core.c:5096, it is pretty evident that it does.My goal with the patch series was to change
dev_errintodev_err_probe, as my understanding ofdev_err_probewas that it's a specialization ofdev_errfor probe contexts.Quoted 5 lines
Jonathan, actually the triggered buffer setup might return not
-ENOMEMerror code for the surprise. After all this series does add not a dead code, but a quite rare to be used one.Agreed and I'm not even sure why that is there (lost to the mists of time / my failing memory ;) However I think it's an obvious driver bug case that should be trivial to see in basic tests so to me it's marginal on whether a print on these is useful.
Quoted 5 lines
Maybe given that one is so rare we should just add a print in the core? I'm not particularly keen on mass patches to print errors from the core code but this one is perhaps a reasonable trade off vs series like this one adding prints to drivers for something we don't think realistically ever happens.
While the series ends up not adding a dead code, the rareness of the case doesn't justify it, so I am still on the side of _not_ applying this series.
For the core printing, I think for devm_*() or other managed resource APIs it makes a lot of sense (in general). Not sure about plain calls, though.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 37 lines · On Thu, 25 Jun 2026 17:03:11 +0300 Andy Shevchenko…
Quoted 4 lines · Jonathan Cameron
Quoted 2 lines · On Wed, 24 Jun 2026 14:26:52 +0300 Andy Shevchenko…
Quoted 1 line · Prashant Rahul
On Wed Jun 24, 2026 at 1:06 AM IST, Jonathan Cameron wrote:
...
Quoted 23 lines
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
Why this particular one but not the
devm_iio_device_register()below it? Both pretty much only fail on driver bugs. Or out of memory for whichdev_err_probe()doesn't print anything anyway (on basis that is normally pretty noisy).My apologies, I wasnt aware that
dev_err_probesimply ignores-ENOMEM. Looking atdrivers/base/core.c:5096, it is pretty evident that it does.My goal with the patch series was to change
dev_errintodev_err_probe, as my understanding ofdev_err_probewas that it's a specialization ofdev_errfor probe contexts.Quoted 5 lines
Jonathan, actually the triggered buffer setup might return not
-ENOMEMerror code for the surprise. After all this series does add not a dead code, but a quite rare to be used one.Agreed and I'm not even sure why that is there (lost to the mists of time / my failing memory ;) However I think it's an obvious driver bug case that should be trivial to see in basic tests so to me it's marginal on whether a print on these is useful.
Quoted 5 lines
Maybe given that one is so rare we should just add a print in the core? I'm not particularly keen on mass patches to print errors from the core code but this one is perhaps a reasonable trade off vs series like this one adding prints to drivers for something we don't think realistically ever happens.
Quoted 6 lines
While the series ends up not adding a dead code, the rareness of the case doesn't justify it, so I am still on the side of _not_ applying this series.
For the core printing, I think for devm_*() or other managed resource APIs it makes a lot of sense (in general). Not sure about plain calls, though.
For now I've picked up the two straight conversions to dev_err_probe() because I'm keen to (slowly) stop using dev_err() in probe functions but lets leave the rest for now at least. If I get some time (you never know) I might throw together an RFC that prints appropriate messages from these IIO registration calls so we can have a debate about whether they belong in the core or the drivers (or not at all).
Thanks,
Jonathan
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 2 lines · Jonathan Cameron
For now I've picked up the two straight conversions to
dev_err_probe()because I'm keen to (slowly) stop usingdev_err()in probe functions.
I can look for places where dev_err() is used and can be replaced with dev_err_probe() in other probe functions, then create a new patch series for it. Without adding new logs or removing any existing ones, of course. Shouldn't take a lot of time, what do you think?
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 8 lines · Prashant Rahul
Quoted 2 lines · Jonathan Cameron
For now I've picked up the two straight conversions to
dev_err_probe()because I'm keen to (slowly) stop usingdev_err()in probe functions.I can look for places where
dev_err()is used and can be replaced withdev_err_probe()in other probe functions, then create a new patch series for it. Without adding new logs or removing any existing ones, of course. Shouldn't take a lot of time, what do you think?
In some cases it would make an additional churn. Each driver may require a unique set of the cleanups and refactoring patches. Better to do something that you have HW to test on.
I also removed some people from the Cc list. Why did you add them?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Prashant Rahul
Quoted 2 lines · Jonathan Cameron
For now I've picked up the two straight conversions to
dev_err_probe()because I'm keen to (slowly) stop usingdev_err()in probe functions.
Quoted 8 lines
Quoted 4 lines
I can look for places where
dev_err()is used and can be replaced withdev_err_probe()in other probe functions, then create a new patch series for it. Without adding new logs or removing any existing ones, of course. Shouldn't take a lot of time, what do you think?In some cases it would make an additional churn. Each driver may require a unique set of the cleanups and refactoring patches. Better to do something that you have HW to test on.
Makes sense.
Quoted 1 line
I also removed some people from the Cc list. Why did you add them?
I am a little confused here. I only added people to the CC list who were already present in the CC list of the original email. Am I missing something?
regards,
Prashant Rahul
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 16 lines · Prashant Rahul
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Prashant Rahul
Quoted 2 lines · Jonathan Cameron
For now I've picked up the two straight conversions to
dev_err_probe()because I'm keen to (slowly) stop usingdev_err()in probe functions.Quoted 8 lines
Quoted 4 lines
I can look for places where
dev_err()is used and can be replaced withdev_err_probe()in other probe functions, then create a new patch series for it. Without adding new logs or removing any existing ones, of course. Shouldn't take a lot of time, what do you think?In some cases it would make an additional churn. Each driver may require a unique set of the cleanups and refactoring patches. Better to do something that you have HW to test on.
Quoted 7 lines
Makes sense.
Quoted 1 line
I also removed some people from the Cc list. Why did you add them?
I am a little confused here. I only added people to the CC list who were already present in the CC list of the original email. Am I missing something?
Which original email? You sent the original patch with unrelated people in the Cc list. get_maintainer.pl doesn't mention them in relation to the patched driver.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
Quoted 10 lines · Andy Shevchenko
Quoted 5 lines · Prashant Rahul
Quoted 1 line
I also removed some people from the Cc list. Why did you add them?
I am a little confused here. I only added people to the CC list who were already present in the CC list of the original email. Am I missing something?
Which original email? You sent the original patch with unrelated people in the Cc list. get_maintainer.pl doesn't mention them in relation to the patched driver.
Sorry for the late reply. I did use the get_maintainer.pl script for this series and only added people from it. Except for Shuah, she is my mentor for LFX - Linux Summer 2026 and we have been asked to mention our mentor(s) in the CC list.
PATCH v2 5/5 iio: adc: ti-adc0832: log buffer setup failure in probe
In reply to Prashant RahulErrors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. Log the error returned by the buffer setup path as well.
--- drivers/iio/adc/ti-adc0832.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-adc0832.c +1 -1
@@ -299,7 +299,7 @@ static int adc0832_probe(struct spi_device *spi) ret =devm_iio_triggered_buffer_setup (&spi->dev, indio_dev,NULL , adc0832_trigger_handler,NULL );if (ret) -return ret; +return dev_err_probe (&spi->dev, ret,"iio triggered buffer setup failed\n" );return devm_iio_device_register (&spi->dev, indio_dev); }
Signature · 1 line
2.54.0
Re: [PATCH v2 5/5] iio: adc: ti-adc0832: log buffer setup failure in probe
Quoted 3 lines · Prashant Rahul
Errors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. Log the error returned by the buffer setup path as well.
...
Quoted 1 line
+++
b/drivers/iio/adc/ti-adc0832.c
So does this (devm_mutex_init() is needed). But they can be done separately from this series.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Prashant Rahul
Errors are logged when enabling the regulator or adding the cleanup action fails, but not when buffer setup fails. This adds that missing log.
OK.
Signature · 2 lines
With Best Regards, Andy Shevchenko