[PATCH 10/12] thermal/drivers/qcom-tsens: simplify with dev_err_probe()

Krzysztof Kozlowski posted 12 patches 1 year, 5 months ago
[PATCH 10/12] thermal/drivers/qcom-tsens: simplify with dev_err_probe()
Posted by Krzysztof Kozlowski 1 year, 5 months ago
Error handling in probe() can be a bit simpler with dev_err_probe().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/thermal/qcom/tsens.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index e76e23026dc8..0b4421bf4785 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -1336,11 +1336,9 @@ static int tsens_probe(struct platform_device *pdev)
 
 	if (priv->ops->calibrate) {
 		ret = priv->ops->calibrate(priv);
-		if (ret < 0) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev, "%s: calibration failed\n", __func__);
-			return ret;
-		}
+		if (ret < 0)
+			return dev_err_probe(dev, ret, "%s: calibration failed\n",
+					     __func__);
 	}
 
 	ret = tsens_register(priv);

-- 
2.43.0
Re: [PATCH 10/12] thermal/drivers/qcom-tsens: simplify with dev_err_probe()
Posted by Bjorn Andersson 1 year, 5 months ago
On Tue, Jul 09, 2024 at 02:59:40PM GMT, Krzysztof Kozlowski wrote:
> Error handling in probe() can be a bit simpler with dev_err_probe().
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Bjorn Andersson <andersson@kernel.org>

Regards,
Bjorn

> ---
>  drivers/thermal/qcom/tsens.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index e76e23026dc8..0b4421bf4785 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -1336,11 +1336,9 @@ static int tsens_probe(struct platform_device *pdev)
>  
>  	if (priv->ops->calibrate) {
>  		ret = priv->ops->calibrate(priv);
> -		if (ret < 0) {
> -			if (ret != -EPROBE_DEFER)
> -				dev_err(dev, "%s: calibration failed\n", __func__);
> -			return ret;
> -		}
> +		if (ret < 0)
> +			return dev_err_probe(dev, ret, "%s: calibration failed\n",
> +					     __func__);
>  	}
>  
>  	ret = tsens_register(priv);
> 
> -- 
> 2.43.0
> 
>