drm/panel: xpp055c272: Make use of the helper function dev_err_probe()
authorCai Huoqing <caihuoqing@baidu.com>
Thu, 16 Sep 2021 10:46:49 +0000 (18:46 +0800)
committerSam Ravnborg <sam@ravnborg.org>
Thu, 14 Oct 2021 20:12:15 +0000 (22:12 +0200)
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210916104650.11781-1-caihuoqing@baidu.com
drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c

index d17aae8..8177f5a 100644 (file)
@@ -283,26 +283,19 @@ static int xpp055c272_probe(struct mipi_dsi_device *dsi)
                return -ENOMEM;
 
        ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
-       if (IS_ERR(ctx->reset_gpio)) {
-               dev_err(dev, "cannot get reset gpio\n");
-               return PTR_ERR(ctx->reset_gpio);
-       }
+       if (IS_ERR(ctx->reset_gpio))
+               return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
+                                    "cannot get reset gpio\n");
 
        ctx->vci = devm_regulator_get(dev, "vci");
-       if (IS_ERR(ctx->vci)) {
-               ret = PTR_ERR(ctx->vci);
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to request vci regulator: %d\n", ret);
-               return ret;
-       }
+       if (IS_ERR(ctx->vci))
+               return dev_err_probe(dev, PTR_ERR(ctx->vci),
+                                    "Failed to request vci regulator\n");
 
        ctx->iovcc = devm_regulator_get(dev, "iovcc");
-       if (IS_ERR(ctx->iovcc)) {
-               ret = PTR_ERR(ctx->iovcc);
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to request iovcc regulator: %d\n", ret);
-               return ret;
-       }
+       if (IS_ERR(ctx->iovcc))
+               return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
+                                    "Failed to request iovcc regulator\n");
 
        mipi_dsi_set_drvdata(dsi, ctx);