In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs.

Signed-off-by: Yuan Can <yuan...@huawei.com>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index b4729a94c34a..b42f5368532b 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -451,12 +451,9 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
        }
 
        ctx->supply = devm_regulator_get(dev, "power");
-       if (IS_ERR(ctx->supply)) {
-               ret = PTR_ERR(ctx->supply);
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "failed to request regulator: %d\n", ret);
-               return ret;
-       }
+       if (IS_ERR(ctx->supply))
+               return dev_err_probe(dev, PTR_ERR(ctx->supply),
+                                    "failed to request regulator\n");
 
        mipi_dsi_set_drvdata(dsi, ctx);
 
-- 
2.17.1

Reply via email to