diff mbox series

i2c: mux: reg: don't log an error for probe deferral

Message ID 20171212101203.22125-1-alexander.sverdlin@nokia.com
State Superseded
Headers show
Series i2c: mux: reg: don't log an error for probe deferral | expand

Commit Message

Alexander A Sverdlin Dec. 12, 2017, 10:12 a.m. UTC
From: Tomasz Bachorski <tomasz.bachorski@nokia.com>

It's possible that i2c_mux_reg_probe_dt() could return -EPROBE_DEFER.
In that case, driver will request a probe deferral and an error
suggesting device tree parsing problem will be reported. This is
a pretty confusing information. Let's change the error handling,
so driver will be able to request probe deferral without logging
not related errors.

Signed-off-by: Tomasz Bachorski <tomasz.bachorski@nokia.com>
---
 drivers/i2c/muxes/i2c-mux-reg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Peter Rosin Dec. 12, 2017, 10:43 a.m. UTC | #1
On 2017-12-12 11:12, Alexander Sverdlin wrote:
> From: Tomasz Bachorski <tomasz.bachorski@nokia.com>
> 
> It's possible that i2c_mux_reg_probe_dt() could return -EPROBE_DEFER.
> In that case, driver will request a probe deferral and an error
> suggesting device tree parsing problem will be reported. This is
> a pretty confusing information. Let's change the error handling,
> so driver will be able to request probe deferral without logging
> not related errors.
> 
> Signed-off-by: Tomasz Bachorski <tomasz.bachorski@nokia.com>
> ---
>  drivers/i2c/muxes/i2c-mux-reg.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
> index f6c9c3dc6cad..e0be96e77231 100644
> --- a/drivers/i2c/muxes/i2c-mux-reg.c
> +++ b/drivers/i2c/muxes/i2c-mux-reg.c
> @@ -177,7 +177,9 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
>  			sizeof(mux->data));
>  	} else {
>  		ret = i2c_mux_reg_probe_dt(mux, pdev);
> -		if (ret < 0) {
> +		if (ret == -EPROBE_DEFER) {
> +			return ret;
> +		} else if (ret < 0) {

Please just add

		if (ret == -EPROBE_DEFER)
			return ret;

before the "if (ret < 0)" check. No need for "else" when you always
return in the "if" body.

Cheers,
Peter

>  			dev_err(&pdev->dev, "Error parsing device tree");
>  			return ret;
>  		}
>
diff mbox series

Patch

diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
index f6c9c3dc6cad..e0be96e77231 100644
--- a/drivers/i2c/muxes/i2c-mux-reg.c
+++ b/drivers/i2c/muxes/i2c-mux-reg.c
@@ -177,7 +177,9 @@  static int i2c_mux_reg_probe(struct platform_device *pdev)
 			sizeof(mux->data));
 	} else {
 		ret = i2c_mux_reg_probe_dt(mux, pdev);
-		if (ret < 0) {
+		if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else if (ret < 0) {
 			dev_err(&pdev->dev, "Error parsing device tree");
 			return ret;
 		}