Skip to contentSkip to conversation

iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()

PATCH Superseded Cai Huoqing 4 participants 17 messages Sep 28, 2021 – Oct 2, 2021

Subsystems (8)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/9 iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/ab8500-gpadc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/ab8500-gpadc.c +3 -5
index 7b5212ba5501..c58d0e2ae538 100644
@@ -1146,11 +1146,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
 	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
-	if (IS_ERR(gpadc->vddadc)) {
-		ret = PTR_ERR(gpadc->vddadc);
-		dev_err(dev, "failed to get vddadc\n");
-		return ret;
-	}
+	if (IS_ERR(gpadc->vddadc))
+		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
+				     "failed to get vddadc\n");
 
 	ret = regulator_enable(gpadc->vddadc);
 	if (ret) {
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 2/9 iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
 drivers/iio/adc/imx7d_adc.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/iio/adc/imx7d_adc.c +5 -11
index 4969a5f941e3..f47360cbff3b 100644
@@ -496,19 +496,13 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 		return irq;
 
 	info->clk = devm_clk_get(dev, "adc");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_err(dev, "Failed getting clock, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n");
 
 	info->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(info->vref)) {
-		ret = PTR_ERR(info->vref);
-		dev_err(dev,
-			"Failed getting reference voltage, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(dev, PTR_ERR(info->vref),
+				     "Failed getting reference voltage\n");
 
 	platform_set_drvdata(pdev, indio_dev);
 
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH v3 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()

Quoted 7 lines · On Tue, 28 Sep 2021 22:19:48 +0800 Cai Huoqing <[email protected]> wrote:

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

Hi Cai,

It is currently not printing a message, but should we handle the same for platform_get_irq?

One other minor comment inline. Actual change here is fine.

Thanks,

Jonathan

Quoted 9 lines
---
 drivers/iio/adc/imx7d_adc.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/iio/adc/imx7d_adc.c +0 -0
index 4969a5f941e3..f47360cbff3b 100644

drivers/iio/adc/imx7d_adc.c static int imx7d_adc_probe(struct platform_device *pdev) · line 500

Quoted 10 lines
drivers/iio/adc/imx7d_adc.c +2 -5
@@ -496,19 +496,13 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 		return irq;
 
 	info->clk = devm_clk_get(dev, "adc");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_err(dev, "Failed getting clock, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n");

Where it doesn't hurt readabilty preferred to keep below 80 chars.

Quoted 14 lines
drivers/iio/adc/imx7d_adc.c +3 -6
 	info->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(info->vref)) {
-		ret = PTR_ERR(info->vref);
-		dev_err(dev,
-			"Failed getting reference voltage, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(dev, PTR_ERR(info->vref),
+				     "Failed getting reference voltage\n");
 
 	platform_set_drvdata(pdev, indio_dev);
 
#3 lore raw

PATCH v3 3/9 iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/lpc18xx_adc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/iio/adc/lpc18xx_adc.c +6 -8
index 3566990ae87d..caa7feb4219f 100644
@@ -137,19 +137,17 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(adc->base);
 
 	adc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(adc->clk)) {
-		dev_err(&pdev->dev, "error getting clock\n");
-		return PTR_ERR(adc->clk);
-	}
+	if (IS_ERR(adc->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk),
+				     "error getting clock\n");
 
 	rate = clk_get_rate(adc->clk);
 	clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
 
 	adc->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(&pdev->dev, "error getting regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref),
+				     "error getting regulator\n");
 
 	indio_dev->name = dev_name(&pdev->dev);
 	indio_dev->info = &lpc18xx_adc_info;
Signature · 7 lines
2.25.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#4 lore raw

PATCH v3 4/9 iio: adc: max1118: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
 drivers/iio/adc/max1118.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/adc/max1118.c +3 -4
index 8cec9d949083..a41bc570be21 100644
@@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi)
 
 	if (id->driver_data == max1118) {
 		adc->reg = devm_regulator_get(&spi->dev, "vref");
-		if (IS_ERR(adc->reg)) {
-			dev_err(&spi->dev, "failed to get vref regulator\n");
-			return PTR_ERR(adc->reg);
-		}
+		if (IS_ERR(adc->reg))
+			return dev_err_probe(&spi->dev, PTR_ERR(adc->reg),
+					     "failed to get vref regulator\n");
 		ret = regulator_enable(adc->reg);
 		if (ret)
 			return ret;
Signature · 1 line
2.25.1
#5 lore raw

PATCH v3 5/9 iio: adc: max1241: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
 drivers/iio/adc/max1241.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/iio/adc/max1241.c +6 -8
index b60f8448f21a..130ca8dc6fa0 100644
@@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi)
 	mutex_init(&adc->lock);
 
 	adc->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(adc->vdd)) {
-		dev_err(dev, "failed to get vdd regulator\n");
-		return PTR_ERR(adc->vdd);
-	}
+	if (IS_ERR(adc->vdd))
+		return dev_err_probe(dev, PTR_ERR(adc->vdd),
+				     "failed to get vdd regulator\n");
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
@@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi)
 	}
 
 	adc->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get vref regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get vref regulator\n");
 
 	ret = regulator_enable(adc->vref);
 	if (ret)
Signature · 1 line
2.25.1
maintainer
#6 lore raw

Re: [PATCH v3 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe()

Quoted 7 lines · On Tue, 28 Sep 2021 22:19:51 +0800 Cai Huoqing <[email protected]> wrote:

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

Hi Cai,

Please also add a message to the devm_gpiod_get_optional() and similar handling so that we maintain information on that as well.

Thanks,

Jonathan

Quoted 36 lines
---
 drivers/iio/adc/max1241.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/iio/adc/max1241.c +6 -8
index b60f8448f21a..130ca8dc6fa0 100644
@@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi)
 	mutex_init(&adc->lock);
 
 	adc->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(adc->vdd)) {
-		dev_err(dev, "failed to get vdd regulator\n");
-		return PTR_ERR(adc->vdd);
-	}
+	if (IS_ERR(adc->vdd))
+		return dev_err_probe(dev, PTR_ERR(adc->vdd),
+				     "failed to get vdd regulator\n");
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
@@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi)
 	}
 
 	adc->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get vref regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get vref regulator\n");
 
 	ret = regulator_enable(adc->vref);
 	if (ret)
#7 lore raw

PATCH v3 6/9 iio: adc: meson_saradc: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/meson_saradc.c | 39 +++++++++++++-----------------
 1 file changed, 17 insertions(+), 22 deletions(-)
drivers/iio/adc/meson_saradc.c +17 -22
index 705d5e11a54b..014a77f98b98 100644
@@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 		return ret;
 
 	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
-	if (IS_ERR(priv->clkin)) {
-		dev_err(&pdev->dev, "failed to get clkin\n");
-		return PTR_ERR(priv->clkin);
-	}
+	if (IS_ERR(priv->clkin))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
+				     "failed to get clkin\n");
 
 	priv->core_clk = devm_clk_get(&pdev->dev, "core");
-	if (IS_ERR(priv->core_clk)) {
-		dev_err(&pdev->dev, "failed to get core clk\n");
-		return PTR_ERR(priv->core_clk);
-	}
+	if (IS_ERR(priv->core_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
+				     "failed to get core clk\n");
 
 	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
 	if (IS_ERR(priv->adc_clk)) {
-		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_clk) == -ENOENT)
 			priv->adc_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc clk\n");
-			return PTR_ERR(priv->adc_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
+					     "failed to get adc clk\n");
 	}
 
 	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
 	if (IS_ERR(priv->adc_sel_clk)) {
-		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
 			priv->adc_sel_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
-			return PTR_ERR(priv->adc_sel_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
+					     "failed to get adc_sel clk\n");
 	}
 
 	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
@@ -1265,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	}
 
 	priv->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(priv->vref)) {
-		dev_err(&pdev->dev, "failed to get vref regulator\n");
-		return PTR_ERR(priv->vref);
-	}
+	if (IS_ERR(priv->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
+				     "failed to get vref regulator\n");
 
 	priv->calibscale = MILLION;
 
Signature · 1 line
2.25.1
reviewer Reviewed-by Reviewed-by on v3 6/9
#8 lore raw

Re: [PATCH v3 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()

Quoted 8 lines · Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

as well as:

# Odroid-C1

Thanks for your contribution!

Best regards,
Martin

maintainer
#9 lore raw

Re: [PATCH v3 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()

Quoted 8 lines · On Sat, 2 Oct 2021 15:01:56 +0200 Martin Blumenstingl…
Quoted 7 lines · Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

Quoted 5 lines
Quoted 1 line

as well as:

# Odroid-C1

Hi Martin,

Confusing tag. Was the second meant to be a Tested-by?

Thanks,

Jonathan

Quoted 6 lines

Thanks for your contribution!

Best regards,
Martin

reviewer Tested-by
#10 lore raw

Re: [PATCH v3 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()

Hi Jonathan,

Quoted 12 lines · Jonathan Cameron
Quoted 8 lines · On Sat, 2 Oct 2021 15:01:56 +0200 Martin Blumenstingl…
Quoted 7 lines · Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

as well as:

# Odroid-C1

Hi Martin,

Confusing tag. Was the second meant to be a Tested-by?

my bad - it is indeed supposed to be:

Testing was done on a Meson8b Odroid-C1 board.

Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#11 lore raw

PATCH v3 7/9 iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

BTW, change the return value from 'ENXIO' to 'ENODEV', perfer ENODEV which means no such device.

---
v2->v3: Update the changelog.

 drivers/iio/adc/qcom-pm8xxx-xoadc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/iio/adc/qcom-pm8xxx-xoadc.c +4 -5
index 0610bf254771..21d7eff645c3 100644
@@ -910,16 +910,15 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
 	map = dev_get_regmap(dev->parent, NULL);
 	if (!map) {
 		dev_err(dev, "parent regmap unavailable.\n");
-		return -ENXIO;
+		return -ENODEV;
 	}
 	adc->map = map;
 
 	/* Bring up regulator */
 	adc->vref = devm_regulator_get(dev, "xoadc-ref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get XOADC VREF regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get XOADC VREF regulator\n");
 	ret = regulator_enable(adc->vref);
 	if (ret) {
 		dev_err(dev, "failed to enable XOADC VREF regulator\n");
Signature · 1 line
2.25.1
Reviewed-by on v3 7/9
#12 lore raw

Re: [PATCH v3 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()

Quoted 6 lines · Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

Quoted 6 lines

BTW, change the return value from 'ENXIO' to 'ENODEV', perfer ENODEV which means no such device.

---
v2->v3: Update the changelog.

Yours,
Linus Walleij

#13 lore raw

PATCH v3 8/9 iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/rockchip_saradc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/rockchip_saradc.c +3 -5
index a56a0d7337ca..57419ccb3c70 100644
@@ -392,11 +392,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 
 	info->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(info->vref)) {
-		dev_err(&pdev->dev, "failed to get regulator, %ld\n",
-			PTR_ERR(info->vref));
-		return PTR_ERR(info->vref);
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
+				     "failed to get regulator\n");
 
 	if (info->reset)
 		rockchip_saradc_reset_controller(info->reset);
Signature · 1 line
2.25.1
maintainer
#14 lore raw

Re: [PATCH v3 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()

Quoted 7 lines · On Tue, 28 Sep 2021 22:19:54 +0800 Cai Huoqing <[email protected]> wrote:

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

In this driver, there is also a call to devm_reset_control_get_exclusive() which I think can return -EPROBE_DEFER

There isn't a message printed on that particular patch, but it would be good to add something generic. Same for platform_get_irq()

There are some devm_clk_get() calls as well which likewise probably want handling in a similar fashion as you have done in other patches.

Thanks,

Jonathan

Quoted 25 lines

---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/rockchip_saradc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/rockchip_saradc.c +3 -5
index a56a0d7337ca..57419ccb3c70 100644
@@ -392,11 +392,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 
 	info->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(info->vref)) {
-		dev_err(&pdev->dev, "failed to get regulator, %ld\n",
-			PTR_ERR(info->vref));
-		return PTR_ERR(info->vref);
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
+				     "failed to get regulator\n");
 
 	if (info->reset)
 		rockchip_saradc_reset_controller(info->reset);
#15 lore raw

PATCH v3 9/9 iio: adc: ti-ads7950: Make use of the helper function dev_err_probe()

In reply to Cai Huoqing

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

---
 drivers/iio/adc/ti-ads7950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-ads7950.c +2 -2
index a2b83f0bd526..a7efa3eada2c 100644
@@ -600,8 +600,8 @@ static int ti_ads7950_probe(struct spi_device *spi)
 
 	st->reg = devm_regulator_get(&spi->dev, "vref");
 	if (IS_ERR(st->reg)) {
-		dev_err(&spi->dev, "Failed to get regulator \"vref\"\n");
-		ret = PTR_ERR(st->reg);
+		ret = dev_err_probe(&spi->dev, PTR_ERR(st->reg),
+				     "Failed to get regulator \"vref\"\n");
 		goto error_destroy_mutex;
 	}
 
Signature · 1 line
2.25.1
maintainer
#16 lore raw
In reply to Cai Huoqing
Quoted 8 lines · On Tue, 28 Sep 2021 22:19:47 +0800 Cai Huoqing <[email protected]> wrote:

When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value gets printed.

I believe we could in theory get an -EPROBE_DEFER from platform_get_irq_by_name() so we should handle that one similarly.

I have no idea if can actually happen on this platform, but seems to me that we should be thorough given how easy it is to do here.

Thanks,

Jonathan

Quoted 15 lines

---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/ab8500-gpadc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/ab8500-gpadc.c +0 -1
index 7b5212ba5501..c58d0e2ae538 100644
@@ -1146,11 +1146,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
 	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
-	if (IS_ERR(gpadc->vddadc)) {

drivers/iio/adc/ab8500-gpadc.c static int ab8500_gpadc_probe(struct platform_device *pdev) · line 1154

Quoted 10 lines
drivers/iio/adc/ab8500-gpadc.c +3 -4
-		ret = PTR_ERR(gpadc->vddadc);
-		dev_err(dev, "failed to get vddadc\n");
-		return ret;
-	}
+	if (IS_ERR(gpadc->vddadc))
+		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
+				     "failed to get vddadc\n");
 
 	ret = regulator_enable(gpadc->vddadc);
 	if (ret) {

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic