* [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors
@ 2026-06-16 13:05 Prashant Rahul
2026-06-16 14:03 ` David Lechner
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
0 siblings, 2 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-16 13:05 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Matti Vaittinen, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior,
Uwe Kleine-König (The Capable Hub), John Ogness,
Dixit Parmar, linux-kernel
This simplifies error handling and ensures consistent error reporting.
Also add missing error messages in a few probe paths where failures were
previously returned without any diagnostics.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc081c.c | 10 ++++------
drivers/iio/adc/ti-adc0832.c | 6 +++---
drivers/iio/adc/ti-adc084s021.c | 3 +--
drivers/iio/adc/ti-adc108s102.c | 2 +-
drivers/iio/adc/ti-adc128s052.c | 2 +-
drivers/iio/adc/ti-adc161s626.c | 6 +++---
6 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 33f82bdfeb94..f6ce23975b80 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -174,26 +174,24 @@ static int adc081c_probe(struct i2c_client *client)
err = regulator_enable(adc->ref);
if (err < 0)
- return err;
+ return dev_err_probe(&client->dev, err, "failed to enable regulator\n");
err = devm_add_action_or_reset(&client->dev, adc081c_reg_disable,
adc->ref);
if (err)
- return err;
+ return dev_err_probe(&client->dev, err, "failed to register cleanup action\n");
iio->name = dev_name(&client->dev);
iio->modes = INDIO_DIRECT_MODE;
iio->info = &adc081c_info;
iio->channels = model->channels;
iio->num_channels = ADC081C_NUM_CHANNELS;
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);
}
diff --git a/drivers/iio/adc/ti-adc0832.c b/drivers/iio/adc/ti-adc0832.c
index cfcdafbe284b..ecd5dbb76e75 100644
--- a/drivers/iio/adc/ti-adc0832.c
+++ b/drivers/iio/adc/ti-adc0832.c
@@ -289,17 +289,17 @@ static int adc0832_probe(struct spi_device *spi)
ret = regulator_enable(adc->reg);
if (ret)
- return ret;
+ return dev_err_probe(&spi->dev, ret, "failed to enable regulator\n");
ret = devm_add_action_or_reset(&spi->dev, adc0832_reg_disable,
adc->reg);
if (ret)
- return ret;
+ return dev_err_probe(&spi->dev, ret, "failed to register cleanup action\n");
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);
}
diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
index a100f770fa1c..9c7ee09955ca 100644
--- a/drivers/iio/adc/ti-adc084s021.c
+++ b/drivers/iio/adc/ti-adc084s021.c
@@ -230,8 +230,7 @@ static int adc084s021_probe(struct spi_device *spi)
adc084s021_buffer_trigger_handler,
&adc084s021_buffer_setup_ops);
if (ret) {
- dev_err(&spi->dev, "Failed to setup triggered buffer\n");
- return ret;
+ return dev_err_probe(&spi->dev, ret, "Failed to setup triggered buffer\n");
}
return devm_iio_device_register(&spi->dev, indio_dev);
diff --git a/drivers/iio/adc/ti-adc108s102.c b/drivers/iio/adc/ti-adc108s102.c
index 7d615e2bbf39..440afe584f5d 100644
--- a/drivers/iio/adc/ti-adc108s102.c
+++ b/drivers/iio/adc/ti-adc108s102.c
@@ -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)
diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
index 4ae65793ad9b..14ed60895ac7 100644
--- a/drivers/iio/adc/ti-adc128s052.c
+++ b/drivers/iio/adc/ti-adc128s052.c
@@ -225,7 +225,7 @@ static int adc128_probe(struct spi_device *spi)
ret = devm_mutex_init(&spi->dev, &adc->lock);
if (ret)
- return ret;
+ return dev_err_probe(&spi->dev, ret, "failed to initialize mutex\n");
return devm_iio_device_register(&spi->dev, indio_dev);
}
diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c
index be1cc2e77862..10c25770a7a6 100644
--- a/drivers/iio/adc/ti-adc161s626.c
+++ b/drivers/iio/adc/ti-adc161s626.c
@@ -207,17 +207,17 @@ static int ti_adc_probe(struct spi_device *spi)
ret = regulator_enable(data->ref);
if (ret < 0)
- return ret;
+ return dev_err_probe(&spi->dev, ret, "failed to enable regulator\n");
ret = devm_add_action_or_reset(&spi->dev, ti_adc_reg_disable,
data->ref);
if (ret)
- return ret;
+ return dev_err_probe(&spi->dev, ret, "failed to add cleanup action\n");
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);
}
--
2.54.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors
2026-06-16 13:05 [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors Prashant Rahul
@ 2026-06-16 14:03 ` David Lechner
2026-06-18 16:52 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
1 sibling, 1 reply; 9+ messages in thread
From: David Lechner @ 2026-06-16 14:03 UTC (permalink / raw)
To: Prashant Rahul, Jonathan Cameron, linux-iio
Cc: Shuah Khan, Nuno Sá, Andy Shevchenko, Matti Vaittinen,
Petr Mladek, Oleg Nesterov, Sebastian Andrzej Siewior,
Uwe Kleine-König (The Capable Hub), John Ogness,
Dixit Parmar, linux-kernel
On 6/16/26 8:05 AM, Prashant Rahul wrote:
> This simplifies error handling and ensures consistent error reporting.
> Also add missing error messages in a few probe paths where failures were
> previously returned without any diagnostics.
>
> Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
> ---
> drivers/iio/adc/ti-adc081c.c | 10 ++++------
> drivers/iio/adc/ti-adc0832.c | 6 +++---
> drivers/iio/adc/ti-adc084s021.c | 3 +--
> drivers/iio/adc/ti-adc108s102.c | 2 +-
> drivers/iio/adc/ti-adc128s052.c | 2 +-
> drivers/iio/adc/ti-adc161s626.c | 6 +++---
> 6 files changed, 13 insertions(+), 16 deletions(-)
Please make one patch per file.
>
> diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
> index 33f82bdfeb94..f6ce23975b80 100644
> --- a/drivers/iio/adc/ti-adc081c.c
> +++ b/drivers/iio/adc/ti-adc081c.c
> @@ -174,26 +174,24 @@ static int adc081c_probe(struct i2c_client *client)
>
> err = regulator_enable(adc->ref);
> if (err < 0)
> - return err;
> + return dev_err_probe(&client->dev, err, "failed to enable regulator\n");
>
> err = devm_add_action_or_reset(&client->dev, adc081c_reg_disable,
> adc->ref);
> if (err)
> - return err;
> + return dev_err_probe(&client->dev, err, "failed to register cleanup action\n");
Please don't add new error messages. If there is a really good
reason to, please do that in a separate patch with a justification
as to why it is needed.
In this particular case, the only error is -ENOMEM, which we never
have an error message for.
Above, for regulator_enable(), an error is already printed in many cases
when it fails, so needing to add an additional error message is questionable.
The same comments apply to the rest of the changes as well. Unless you actually
hit one of these errors and found it difficult to troubleshoot without an
additional message, then it probably isn't an improvement.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors
2026-06-16 14:03 ` David Lechner
@ 2026-06-18 16:52 ` Prashant Rahul
0 siblings, 0 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 16:52 UTC (permalink / raw)
To: David Lechner, Prashant Rahul, Jonathan Cameron, linux-iio
Cc: Shuah Khan, Nuno Sá, Andy Shevchenko, Matti Vaittinen,
Petr Mladek, Oleg Nesterov, Sebastian Andrzej Siewior,
Uwe Kleine-König (The Capable Hub), John Ogness,
Dixit Parmar, linux-kernel
On Tue Jun 16, 2026 at 7:33 PM IST, David Lechner wrote:
> Please make one patch per file.
will do
> Please don't add new error messages. If there is a really good
> reason to, please do that in a separate patch with a justification
> as to why it is needed.
> In this particular case, the only error is -ENOMEM, which we never
> have an error message for.
I understand. I will remove the additional logs, except the ones after
`devm_iio_triggered_buffer_setup` for -ENOMEM.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/5] use dev_err_probe for probe time error
2026-06-16 13:05 [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors Prashant Rahul
2026-06-16 14:03 ` David Lechner
@ 2026-06-18 23:14 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 1/5] iio: adc: ti-adc081c: " Prashant Rahul
` (4 more replies)
1 sibling, 5 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 23:14 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior, John Ogness, linux-kernel
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.
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 | 3 +--
drivers/iio/adc/ti-adc108s102.c | 2 +-
drivers/iio/adc/ti-adc161s626.c | 2 +-
5 files changed, 6 insertions(+), 9 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/5] iio: adc: ti-adc081c: use dev_err_probe for probe time error
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
@ 2026-06-18 23:14 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 2/5] iio: adc: ti-adc084s021: " Prashant Rahul
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 23:14 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior, John Ogness, linux-kernel
This simplifies error handling and ensures consistent error reporting.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc081c.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 33f82bdfeb94..29dd7cf25f79 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -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);
}
--
2.54.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/5] iio: adc: ti-adc084s021: use dev_err_probe for probe time error
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
2026-06-18 23:14 ` [PATCH 1/5] iio: adc: ti-adc081c: " Prashant Rahul
@ 2026-06-18 23:14 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 3/5] iio: adc: ti-adc108s102: log buffer setup failure in probe Prashant Rahul
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 23:14 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior, John Ogness, linux-kernel
This simplifies error handling and ensures consistent error reporting.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc084s021.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
index a100f770fa1c..9c7ee09955ca 100644
--- a/drivers/iio/adc/ti-adc084s021.c
+++ b/drivers/iio/adc/ti-adc084s021.c
@@ -230,8 +230,7 @@ static int adc084s021_probe(struct spi_device *spi)
adc084s021_buffer_trigger_handler,
&adc084s021_buffer_setup_ops);
if (ret) {
- dev_err(&spi->dev, "Failed to setup triggered buffer\n");
- return ret;
+ return dev_err_probe(&spi->dev, ret, "Failed to setup triggered buffer\n");
}
return devm_iio_device_register(&spi->dev, indio_dev);
--
2.54.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/5] iio: adc: ti-adc108s102: log buffer setup failure in probe
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
2026-06-18 23:14 ` [PATCH 1/5] iio: adc: ti-adc081c: " Prashant Rahul
2026-06-18 23:14 ` [PATCH 2/5] iio: adc: ti-adc084s021: " Prashant Rahul
@ 2026-06-18 23:14 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 4/5] iio: adc: ti-adc161s626: " Prashant Rahul
2026-06-18 23:14 ` [PATCH 5/5] iio: adc: ti-adc0832: " Prashant Rahul
4 siblings, 0 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 23:14 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior, John Ogness, linux-kernel
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.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc108s102.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-adc108s102.c b/drivers/iio/adc/ti-adc108s102.c
index 7d615e2bbf39..440afe584f5d 100644
--- a/drivers/iio/adc/ti-adc108s102.c
+++ b/drivers/iio/adc/ti-adc108s102.c
@@ -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)
--
2.54.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] iio: adc: ti-adc161s626: log buffer setup failure in probe
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
` (2 preceding siblings ...)
2026-06-18 23:14 ` [PATCH 3/5] iio: adc: ti-adc108s102: log buffer setup failure in probe Prashant Rahul
@ 2026-06-18 23:14 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 5/5] iio: adc: ti-adc0832: " Prashant Rahul
4 siblings, 0 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 23:14 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior, John Ogness, linux-kernel
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.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc161s626.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c
index be1cc2e77862..f83073280c9c 100644
--- a/drivers/iio/adc/ti-adc161s626.c
+++ b/drivers/iio/adc/ti-adc161s626.c
@@ -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);
}
--
2.54.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/5] iio: adc: ti-adc0832: log buffer setup failure in probe
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
` (3 preceding siblings ...)
2026-06-18 23:14 ` [PATCH 4/5] iio: adc: ti-adc161s626: " Prashant Rahul
@ 2026-06-18 23:14 ` Prashant Rahul
4 siblings, 0 replies; 9+ messages in thread
From: Prashant Rahul @ 2026-06-18 23:14 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Oleg Nesterov,
Sebastian Andrzej Siewior, John Ogness, linux-kernel
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.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc0832.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-adc0832.c b/drivers/iio/adc/ti-adc0832.c
index cfcdafbe284b..417e54223092 100644
--- a/drivers/iio/adc/ti-adc0832.c
+++ b/drivers/iio/adc/ti-adc0832.c
@@ -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);
}
--
2.54.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-06-18 23:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16 13:05 [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors Prashant Rahul
2026-06-16 14:03 ` David Lechner
2026-06-18 16:52 ` Prashant Rahul
2026-06-18 23:14 ` [PATCH 0/5] use dev_err_probe for probe time error Prashant Rahul
2026-06-18 23:14 ` [PATCH 1/5] iio: adc: ti-adc081c: " Prashant Rahul
2026-06-18 23:14 ` [PATCH 2/5] iio: adc: ti-adc084s021: " Prashant Rahul
2026-06-18 23:14 ` [PATCH 3/5] iio: adc: ti-adc108s102: log buffer setup failure in probe Prashant Rahul
2026-06-18 23:14 ` [PATCH 4/5] iio: adc: ti-adc161s626: " Prashant Rahul
2026-06-18 23:14 ` [PATCH 5/5] iio: adc: ti-adc0832: " Prashant Rahul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox