diff mbox series

[09/10] drm/panel: s6d16d0: Use dev_err_probe() to simplify code

Message ID 20220924015616.34293-10-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-samsung-s6d16d0.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 008e2b0d6652..2900b2c879dc 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -193,12 +193,9 @@  static int s6d16d0_probe(struct mipi_dsi_device *dsi)
 	/* This asserts RESET by default */
 	s6->reset_gpio = devm_gpiod_get_optional(dev, "reset",
 						 GPIOD_OUT_HIGH);
-	if (IS_ERR(s6->reset_gpio)) {
-		ret = PTR_ERR(s6->reset_gpio);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "failed to request GPIO (%d)\n", ret);
-		return ret;
-	}
+	if (IS_ERR(s6->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(s6->reset_gpio),
+				     "failed to request GPIO\n");
 
 	drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);