diff mbox series

[03/10] drm/panel: elida-kd35t133: Use dev_err_probe() to simplify code

Message ID 20220924015616.34293-4-yuancan@huawei.com (mailing list archive)
State New, archived
Headers show
Series drm/panel: Use dev_err_probe() to simplify code | expand

Commit Message

Yuan Can Sept. 24, 2022, 1:56 a.m. UTC
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@huawei.com>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff mbox series

Patch

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) {