Commit 9f78b3ae authored by Chen Haonan's avatar Chen Haonan Committed by Neil Armstrong

drm/panel: Simplify with dev_err_probe()

dev_err_probe() can check if the error code is -EPROBE_DEFER
and can return the error code, replacing dev_err() with it
simplifies the code.
Signed-off-by: default avatarChen Haonan <chen.haonan2@zte.com.cn>
Reviewed-by: default avatarJessica Zhang <quic_jesszhan@quicinc.com>
Link: https://lore.kernel.org/r/3ac20d355b0b3ad3cedb87c8f4efa819a055624b.1702967834.git.chen.haonan2@zte.com.cnSigned-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/3ac20d355b0b3ad3cedb87c8f4efa819a055624b.1702967834.git.chen.haonan2@zte.com.cn
parent ea4f9975
...@@ -854,26 +854,20 @@ static int panel_add(struct panel_info *pinfo) ...@@ -854,26 +854,20 @@ static int panel_add(struct panel_info *pinfo)
pinfo->pp18_gpio = devm_gpiod_get(dev, "pp18", GPIOD_OUT_HIGH); pinfo->pp18_gpio = devm_gpiod_get(dev, "pp18", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->pp18_gpio)) { if (IS_ERR(pinfo->pp18_gpio)) {
ret = PTR_ERR(pinfo->pp18_gpio); return dev_err_probe(dev, PTR_ERR(pinfo->pp18_gpio),
if (ret != -EPROBE_DEFER) "failed to get pp18 gpio\n");
dev_err(dev, "failed to get pp18 gpio: %d\n", ret);
return ret;
} }
pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH); pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->pp33_gpio)) { if (IS_ERR(pinfo->pp33_gpio)) {
ret = PTR_ERR(pinfo->pp33_gpio); return dev_err_probe(dev, PTR_ERR(pinfo->pp33_gpio),
if (ret != -EPROBE_DEFER) "failed to get pp33 gpio\n");
dev_err(dev, "failed to get pp33 gpio: %d\n", ret);
return ret;
} }
pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->enable_gpio)) { if (IS_ERR(pinfo->enable_gpio)) {
ret = PTR_ERR(pinfo->enable_gpio); return dev_err_probe(dev, PTR_ERR(pinfo->enable_gpio),
if (ret != -EPROBE_DEFER) "failed to get enable gpio\n");
dev_err(dev, "failed to get enable gpio: %d\n", ret);
return ret;
} }
drm_panel_init(&pinfo->base, dev, &panel_funcs, drm_panel_init(&pinfo->base, dev, &panel_funcs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment