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