[PATCH 03/10] drm/panel: elida-kd35t133: Use dev_err_probe() to simplify code
Yuan Can
yuancan at huawei.com
Sat Sep 24 01:56:09 UTC 2022
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 <yuancan at huawei.com>
---
drivers/gpu/drm/panel/panel-elida-kd35t133.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index eee714cf3f49..ffed705201af 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -257,20 +257,14 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
}
ctx->vdd = devm_regulator_get(dev, "vdd");
- if (IS_ERR(ctx->vdd)) {
- ret = PTR_ERR(ctx->vdd);
- if (ret != -EPROBE_DEFER)
- dev_err(dev, "Failed to request vdd regulator: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(ctx->vdd))
+ return dev_err_probe(dev, PTR_ERR(ctx->vdd),
+ "Failed to request vdd regulator\n");
ctx->iovcc = devm_regulator_get(dev, "iovcc");
- if (IS_ERR(ctx->iovcc)) {
- ret = PTR_ERR(ctx->iovcc);
- if (ret != -EPROBE_DEFER)
- dev_err(dev, "Failed to request iovcc regulator: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(ctx->iovcc))
+ return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
+ "Failed to request iovcc regulator\n");
ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
if (ret < 0) {
--
2.17.1
More information about the dri-devel
mailing list