Skip to contentSkip to conversation

regulator: anatop: Drop error message for -EPROBE_DEFER

PATCH Superseded Anson Huang 2 participants 4 messages Mar 3, 2020 Voltage and current regulator framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: anatop: Drop error message for -EPROBE_DEFER

devm_regulator_register() could return -EPROBE_DEFER when trying to get init data and NOT all resources are available at that time, for this case, error message should NOT be present, the driver will call probe again later, so drop error message for -EPROBE_DEFER.

---
 drivers/regulator/anatop-regulator.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/regulator/anatop-regulator.c +4 -3
index 754739d..41470a8 100644
@@ -305,9 +305,10 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 	/* register regulator */
 	rdev = devm_regulator_register(dev, rdesc, &config);
 	if (IS_ERR(rdev)) {
-		dev_err(dev, "failed to register %s\n",
-			rdesc->name);
-		return PTR_ERR(rdev);
+		ret = PTR_ERR(rdev);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "failed to register %s\n", rdesc->name);
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, rdev);
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 4 lines · Anson Huang

devm_regulator_register() could return -EPROBE_DEFER when trying to get init data and NOT all resources are available at that time, for this case, error message should NOT be present, the driver will call probe again later, so drop error message for -EPROBE_DEFER.

No, this is not good - it means that if there is some problem the user will not get any information about why the driver is not instantiating and how to fix it. At most lower the message to dev_dbg().

#2 lore raw

Hi, Mark

Quoted 4 lines

Subject: Re: [PATCH] regulator: anatop: Drop error message for - EPROBE_DEFER

On Tue, Mar 03, 2020 at 11:14:21AM +0800, Anson Huang wrote:

Quoted 8 lines
Quoted 4 lines

devm_regulator_register() could return -EPROBE_DEFER when trying to get init data and NOT all resources are available at that time, for this case, error message should NOT be present, the driver will call probe again later, so drop error message for -EPROBE_DEFER.

No, this is not good - it means that if there is some problem the user will not get any information about why the driver is not instantiating and how to fix it. At most lower the message to dev_dbg().

Make sense, will lower the message to debug level for -EPROBE_DEFER, it is just because that user ever complained about the error message in normal level for defer probe scenario, that is why I do this patch.

Thanks,
Anson

maintainer
#3 lore raw
Quoted 3 lines · Anson Huang

Make sense, will lower the message to debug level for -EPROBE_DEFER, it is just because that user ever complained about the error message in normal level for defer probe scenario, that is why I do this patch.

Yes, lowering the severity makes sense.