* [PATCH v6 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling
@ 2026-08-06 2:38 mdshahid03
2026-08-06 2:39 ` [PATCH v6 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mdshahid03 @ 2026-08-06 2:38 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Andy Shevchenko, David Lechner, Nuno Sá, Ray Jui,
Scott Branden, Broadcom internal kernel review list,
Markus Elfring, Joshua Crofts, linux-iio, linux-arm-kernel,
linux-kernel, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
This series simplifies probe error handling in bcm_iproc_adc.
Patch 1 removes redundant probe error messages where lower-level
helpers already report failures.
Patch 2 introduces a local device pointer to reduce repetition and
prepare for subsequent error handling cleanup.
Patch 3 converts immediate-return probe error paths to dev_err_probe()
while leaving cleanup paths unchanged.
Changes in v6:
- Restore the original formatting in Patch 2 to avoid unnecessary code
churn, as suggested by Jonathan.
- Reduce indentation in selected dev_err_probe() calls in Patch 3
following review comments from Markus.
---
Mohammad Shahid (3):
iio: adc: bcm_iproc_adc: Remove redundant probe error messages
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 | 46 ++++++++++++---------------------
1 file changed, 16 insertions(+), 30 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v6 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages
2026-08-06 2:38 [PATCH v6 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
@ 2026-08-06 2:39 ` mdshahid03
2026-08-06 2:39 ` [PATCH v6 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
2026-08-06 2:39 ` [PATCH v6 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-08-06 2:39 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Andy Shevchenko, David Lechner, Nuno Sá, Ray Jui,
Scott Branden, Broadcom internal kernel review list,
Markus Elfring, Joshua Crofts, linux-iio, linux-arm-kernel,
linux-kernel, 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.
Similarly, iproc_adc_enable() already reports failures, making the
additional dev_err() in the probe path redundant.
Remove both duplicate messages.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/iio/adc/bcm_iproc_adc.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index cf4738b16e62..7c2e2770cd61 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) {
@@ -564,10 +562,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
}
ret = iproc_adc_enable(indio_dev);
- if (ret) {
- dev_err(&pdev->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;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v6 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer
2026-08-06 2:38 [PATCH v6 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-08-06 2:39 ` [PATCH v6 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
@ 2026-08-06 2:39 ` mdshahid03
2026-08-06 2:39 ` [PATCH v6 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-08-06 2:39 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Andy Shevchenko, David Lechner, Nuno Sá, Ray Jui,
Scott Branden, Broadcom internal kernel review list,
Markus Elfring, Joshua Crofts, linux-iio, linux-arm-kernel,
linux-kernel, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
Introduce a local 'struct device *dev' variable in iproc_adc_probe()
and use it for device-managed helper calls instead of repeatedly
referencing '&pdev->dev'.
No functional change intended.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/iio/adc/bcm_iproc_adc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 7c2e2770cd61..a07a590662c4 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -506,10 +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,
- sizeof(*adc_priv));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*adc_priv));
if (!indio_dev)
return -ENOMEM;
@@ -528,7 +528,7 @@ static int iproc_adc_probe(struct platform_device *pdev)
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,
"failed getting clock tsc_clk\n");
@@ -547,7 +547,7 @@ static int iproc_adc_probe(struct platform_device *pdev)
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);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v6 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
2026-08-06 2:38 [PATCH v6 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-08-06 2:39 ` [PATCH v6 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
2026-08-06 2:39 ` [PATCH v6 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
@ 2026-08-06 2:39 ` mdshahid03
2 siblings, 0 replies; 4+ messages in thread
From: mdshahid03 @ 2026-08-06 2:39 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Andy Shevchenko, David Lechner, Nuno Sá, Ray Jui,
Scott Branden, Broadcom internal kernel review list,
Markus Elfring, Joshua Crofts, linux-iio, linux-arm-kernel,
linux-kernel, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
Replace open-coded dev_err() followed by return with dev_err_probe()
for probe failures that immediately return.
Leave error paths that jump to cleanup labels unchanged to reduce code
churn. These paths will be converted separately together with the
planned devm-managed cleanup using devm_add_action_or_reset().
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/iio/adc/bcm_iproc_adc.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index a07a590662c4..ab66b97d2f04 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -522,19 +522,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");
- 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(&pdev->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)
@@ -542,10 +537,8 @@ 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);
- 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,
@@ -555,11 +548,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
return ret;
ret = clk_prepare_enable(adc_priv->adc_clk);
- if (ret) {
- dev_err(&pdev->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)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-06 2:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 2:38 [PATCH v6 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-08-06 2:39 ` [PATCH v6 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
2026-08-06 2:39 ` [PATCH v6 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
2026-08-06 2:39 ` [PATCH v6 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