[PATCH 06/10] drm/panel: lvds: Use dev_err_probe() to simplify code

Yuan Can yuancan at huawei.com
Sat Sep 24 01:56:12 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-lvds.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index de8758c30e6e..e2ed96770abc 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -178,12 +178,9 @@ static int panel_lvds_probe(struct platform_device *pdev)
 	if (IS_ERR(lvds->supply)) {
 		ret = PTR_ERR(lvds->supply);
 
-		if (ret != -ENODEV) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(lvds->dev, "failed to request regulator: %d\n",
-					ret);
-			return ret;
-		}
+		if (ret != -ENODEV)
+			return dev_err_probe(lvds->dev, ret,
+					     "failed to request regulator\n");
 
 		lvds->supply = NULL;
 	}
-- 
2.17.1



More information about the dri-devel mailing list