[PATCH 09/10] drm/panel: s6d16d0: Use dev_err_probe() to simplify code
Yuan Can
yuancan at huawei.com
Sat Sep 24 01:56:15 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-samsung-s6d16d0.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
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);
--
2.17.1
More information about the dri-devel
mailing list