* [PATCH v3 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling
@ 2026-07-31 18:23 mdshahid03
2026-07-31 18:23 ` [PATCH v3 1/3] iio: adc: bcm_iproc_adc: Remove redundant error message after devm_request_threaded_irq() mdshahid03
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mdshahid03 @ 2026-07-31 18:23 UTC (permalink / raw)
To: Jonathan Cameron, Andy Shevchenko
Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
Scott Branden, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
Hi,
This series simplifies the probe error handling in bcm_iproc_adc.
Changes in v3:
- Split the changes into three patches.
- Remove the redundant dev_err() after devm_request_threaded_irq().
- Introduce a local device pointer.
- Convert the remaining applicable probe error paths to dev_err_probe().
- Keep the original platform_get_irq() and devm_request_threaded_irq().
- Remove the redundant dev_err() after iproc_adc_enable().
- Convert the iio_device_register() error path to dev_err_probe().
Thanks,
Shahid
Mohammad Shahid (3):
iio: adc: bcm_iproc_adc: Remove redundant error message after
devm_request_threaded_irq()
iio: adc: bcm_iproc_adc: Introduce local device pointer
iio: adc: bcm_iproc_adc: Convert probe error handling to
dev_err_probe()
drivers/iio/adc/bcm_iproc_adc.c | 54 +++++++++++++++------------------
1 file changed, 24 insertions(+), 30 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 1/3] iio: adc: bcm_iproc_adc: Remove redundant error message after devm_request_threaded_irq()
2026-07-31 18:23 [PATCH v3 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
@ 2026-07-31 18:23 ` mdshahid03
2026-07-31 18:23 ` [PATCH v3 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
2026-07-31 18:23 ` [PATCH v3 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
2 siblings, 0 replies; 4+ messages in thread
From: mdshahid03 @ 2026-07-31 18:23 UTC (permalink / raw)
To: Jonathan Cameron, Andy Shevchenko
Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
Scott Branden, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
devm_request_threaded_irq() already logs an error when the request
fails, making the explicit dev_err() redundant.
Remove the duplicate message and simply return the error.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/iio/adc/bcm_iproc_adc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index cf4738b16e62..1b0dd654402f 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -551,10 +551,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
iproc_adc_interrupt_handler,
iproc_adc_interrupt_thread,
IRQF_SHARED, "iproc-adc", indio_dev);
- if (ret) {
- dev_err(&pdev->dev, "request_irq error %d\n", ret);
+ if (ret)
return ret;
- }
ret = clk_prepare_enable(adc_priv->adc_clk);
if (ret) {
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer
2026-07-31 18:23 [PATCH v3 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-07-31 18:23 ` [PATCH v3 1/3] iio: adc: bcm_iproc_adc: Remove redundant error message after devm_request_threaded_irq() mdshahid03
@ 2026-07-31 18:23 ` mdshahid03
2026-07-31 18:23 ` [PATCH v3 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
2 siblings, 0 replies; 4+ messages in thread
From: mdshahid03 @ 2026-07-31 18:23 UTC (permalink / raw)
To: Jonathan Cameron, Andy Shevchenko
Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
Scott Branden, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
Introduce a local 'struct device *dev' variable in iproc_adc_probe()
and use it instead of repeatedly referencing '&pdev->dev'.
This simplifies the code and makes subsequent error handling changes
less verbose.
No functional change intended.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/iio/adc/bcm_iproc_adc.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 1b0dd654402f..29ea35972a23 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -506,9 +506,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
{
struct iproc_adc_priv *adc_priv;
struct iio_dev *indio_dev = NULL;
+ struct device *dev = &pdev->dev;
int ret;
- indio_dev = devm_iio_device_alloc(&pdev->dev,
+ indio_dev = devm_iio_device_alloc(dev,
sizeof(*adc_priv));
if (!indio_dev)
return -ENOMEM;
@@ -523,14 +524,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
"adc-syscon");
if (IS_ERR(adc_priv->regmap)) {
- dev_err(&pdev->dev, "failed to get handle for tsc syscon\n");
+ dev_err(dev, "failed to get handle for tsc syscon\n");
ret = PTR_ERR(adc_priv->regmap);
return ret;
}
- adc_priv->adc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
+ adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
if (IS_ERR(adc_priv->adc_clk)) {
- dev_err(&pdev->dev,
+ dev_err(dev,
"failed getting clock tsc_clk\n");
ret = PTR_ERR(adc_priv->adc_clk);
return ret;
@@ -543,11 +544,11 @@ static int iproc_adc_probe(struct platform_device *pdev)
ret = regmap_clear_bits(adc_priv->regmap, IPROC_REGCTL2,
IPROC_ADC_AUXIN_SCAN_ENA);
if (ret) {
- dev_err(&pdev->dev, "failed to write IPROC_REGCTL2 %d\n", ret);
+ dev_err(dev, "failed to write IPROC_REGCTL2 %d\n", ret);
return ret;
}
- ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno,
+ ret = devm_request_threaded_irq(dev, adc_priv->irqno,
iproc_adc_interrupt_handler,
iproc_adc_interrupt_thread,
IRQF_SHARED, "iproc-adc", indio_dev);
@@ -556,14 +557,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
ret = clk_prepare_enable(adc_priv->adc_clk);
if (ret) {
- dev_err(&pdev->dev,
+ dev_err(dev,
"clk_prepare_enable failed %d\n", ret);
return ret;
}
ret = iproc_adc_enable(indio_dev);
if (ret) {
- dev_err(&pdev->dev, "failed to enable adc %d\n", ret);
+ dev_err(dev, "failed to enable adc %d\n", ret);
goto err_adc_enable;
}
@@ -575,7 +576,7 @@ static int iproc_adc_probe(struct platform_device *pdev)
ret = iio_device_register(indio_dev);
if (ret) {
- dev_err(&pdev->dev, "iio_device_register failed:err %d\n", ret);
+ dev_err(dev, "iio_device_register failed:err %d\n", ret);
goto err_clk;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
2026-07-31 18:23 [PATCH v3 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-07-31 18:23 ` [PATCH v3 1/3] iio: adc: bcm_iproc_adc: Remove redundant error message after devm_request_threaded_irq() mdshahid03
2026-07-31 18:23 ` [PATCH v3 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
@ 2026-07-31 18:23 ` mdshahid03
2 siblings, 0 replies; 4+ messages in thread
From: mdshahid03 @ 2026-07-31 18:23 UTC (permalink / raw)
To: Jonathan Cameron, Andy Shevchenko
Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
Scott Branden, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
This simplifies the probe error handling by replacing open-coded
dev_err() and return sequences. Also remove the redundant
dev_err() after iproc_adc_enable(), as the helper already reports
the failure.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/iio/adc/bcm_iproc_adc.c | 43 +++++++++++++++------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 29ea35972a23..5fcd528eb88a 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -523,19 +523,16 @@ static int iproc_adc_probe(struct platform_device *pdev)
adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
"adc-syscon");
- if (IS_ERR(adc_priv->regmap)) {
- dev_err(dev, "failed to get handle for tsc syscon\n");
- ret = PTR_ERR(adc_priv->regmap);
- return ret;
- }
+ if (IS_ERR(adc_priv->regmap))
+ return dev_err_probe(dev,
+ PTR_ERR(adc_priv->regmap),
+ "failed to get handle for tsc syscon\n");
adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
- if (IS_ERR(adc_priv->adc_clk)) {
- dev_err(dev,
- "failed getting clock tsc_clk\n");
- ret = PTR_ERR(adc_priv->adc_clk);
- return ret;
- }
+ if (IS_ERR(adc_priv->adc_clk))
+ return dev_err_probe(dev,
+ PTR_ERR(adc_priv->adc_clk),
+ "failed getting clock tsc_clk\n");
adc_priv->irqno = platform_get_irq(pdev, 0);
if (adc_priv->irqno < 0)
@@ -543,10 +540,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
ret = regmap_clear_bits(adc_priv->regmap, IPROC_REGCTL2,
IPROC_ADC_AUXIN_SCAN_ENA);
- if (ret) {
- dev_err(dev, "failed to write IPROC_REGCTL2 %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev,
+ ret,
+ "failed to write IPROC_REGCTL2\n");
ret = devm_request_threaded_irq(dev, adc_priv->irqno,
iproc_adc_interrupt_handler,
@@ -556,17 +553,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
return ret;
ret = clk_prepare_enable(adc_priv->adc_clk);
- if (ret) {
- dev_err(dev,
- "clk_prepare_enable failed %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev,
+ ret,
+ "failed to enable clock\n");
ret = iproc_adc_enable(indio_dev);
- if (ret) {
- dev_err(dev, "failed to enable adc %d\n", ret);
+ if (ret)
goto err_adc_enable;
- }
indio_dev->name = "iproc-static-adc";
indio_dev->info = &iproc_adc_iio_info;
@@ -576,7 +570,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
ret = iio_device_register(indio_dev);
if (ret) {
- dev_err(dev, "iio_device_register failed:err %d\n", ret);
+ dev_err_probe(dev, ret,
+ "failed to register IIO device\n");
goto err_clk;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-31 18:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 18:23 [PATCH v3 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-07-31 18:23 ` [PATCH v3 1/3] iio: adc: bcm_iproc_adc: Remove redundant error message after devm_request_threaded_irq() mdshahid03
2026-07-31 18:23 ` [PATCH v3 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
2026-07-31 18:23 ` [PATCH v3 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox