2020-03-03 03:21:08

by Anson Huang

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Anson Huang <[email protected]>
---
drivers/regulator/anatop-regulator.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 754739d..41470a8 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -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);
--
2.7.4


2020-03-03 12:59:49

by Mark Brown

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

On Tue, Mar 03, 2020 at 11:14:21AM +0800, Anson Huang wrote:
> 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().


Attachments:
(No filename) (546.00 B)
signature.asc (499.00 B)
Download all attachments

2020-03-03 13:39:16

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH] regulator: anatop: Drop error message for -EPROBE_DEFER

Hi, Mark

> Subject: Re: [PATCH] regulator: anatop: Drop error message for -
> EPROBE_DEFER
>
> On Tue, Mar 03, 2020 at 11:14:21AM +0800, Anson Huang wrote:
> > 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

2020-03-03 13:41:57

by Mark Brown

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

On Tue, Mar 03, 2020 at 01:23:19PM +0000, Anson Huang wrote:

> 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.


Attachments:
(No filename) (325.00 B)
signature.asc (499.00 B)
Download all attachments