[PATCH 1/5] iio: adc: aspeed: Simplify with dev_err_probe

Krzysztof Kozlowski posted 5 patches 1 month, 2 weeks ago
[PATCH 1/5] iio: adc: aspeed: Simplify with dev_err_probe
Posted by Krzysztof Kozlowski 1 month, 2 weeks ago
Use dev_err_probe() to make error code handling simpler and handle
deferred probe nicely (avoid spamming logs).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/iio/adc/aspeed_adc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
index bf2bfd6bdc41..1ae45fe90e6c 100644
--- a/drivers/iio/adc/aspeed_adc.c
+++ b/drivers/iio/adc/aspeed_adc.c
@@ -535,11 +535,10 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(data->clk_scaler);
 
 	data->rst = devm_reset_control_get_shared(&pdev->dev, NULL);
-	if (IS_ERR(data->rst)) {
-		dev_err(&pdev->dev,
-			"invalid or missing reset controller device tree entry");
-		return PTR_ERR(data->rst);
-	}
+	if (IS_ERR(data->rst))
+		return dev_err_probe(&pdev->dev, PTR_ERR(data->rst),
+				     "invalid or missing reset controller device tree entry");
+
 	reset_control_deassert(data->rst);
 
 	ret = devm_add_action_or_reset(data->dev, aspeed_adc_reset_assert,

-- 
2.51.0
Re: [PATCH 1/5] iio: adc: aspeed: Simplify with dev_err_probe
Posted by Jonathan Cameron 1 month, 2 weeks ago
On Fri, 19 Dec 2025 15:31:50 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:

> Use dev_err_probe() to make error code handling simpler and handle
> deferred probe nicely (avoid spamming logs).
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Not a comment on this patch as such, but this would benefit from a local
struct device *dev


> ---
>  drivers/iio/adc/aspeed_adc.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c
> index bf2bfd6bdc41..1ae45fe90e6c 100644
> --- a/drivers/iio/adc/aspeed_adc.c
> +++ b/drivers/iio/adc/aspeed_adc.c
> @@ -535,11 +535,10 @@ static int aspeed_adc_probe(struct platform_device *pdev)
>  		return PTR_ERR(data->clk_scaler);
>  
>  	data->rst = devm_reset_control_get_shared(&pdev->dev, NULL);
> -	if (IS_ERR(data->rst)) {
> -		dev_err(&pdev->dev,
> -			"invalid or missing reset controller device tree entry");
> -		return PTR_ERR(data->rst);
> -	}
> +	if (IS_ERR(data->rst))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(data->rst),
> +				     "invalid or missing reset controller device tree entry");
> +
>  	reset_control_deassert(data->rst);
>  
>  	ret = devm_add_action_or_reset(data->dev, aspeed_adc_reset_assert,
>
Re: [PATCH 1/5] iio: adc: aspeed: Simplify with dev_err_probe
Posted by Krzysztof Kozlowski 1 month, 2 weeks ago
On 21/12/2025 13:04, Jonathan Cameron wrote:
> On Fri, 19 Dec 2025 15:31:50 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
> 
>> Use dev_err_probe() to make error code handling simpler and handle
>> deferred probe nicely (avoid spamming logs).
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> Not a comment on this patch as such, but this would benefit from a local
> struct device *dev

Ack

Best regards,
Krzysztof