Message ID | 20220924015616.34293-7-yuancan@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/panel: Use dev_err_probe() to simplify code | expand |
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; }
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-lvds.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)