drm: rcar-du: Use dev_err_probe() to record cause of KMS init errors
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 30 May 2023 09:19:58 +0000 (12:19 +0300)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 14 Aug 2023 10:47:29 +0000 (13:47 +0300)
The (large) rcar_du_modeset_init() function can fail for many reasons,
two of two involving probe deferral. Use dev_err_probe() in those code
paths to record the cause of the probe deferral, in order to help
debugging probe issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c

index ec3cf23..dee530e 100644 (file)
@@ -696,6 +696,10 @@ static int rcar_du_probe(struct platform_device *pdev)
        /* DRM/KMS objects */
        ret = rcar_du_modeset_init(rcdu);
        if (ret < 0) {
+               /*
+                * Don't use dev_err_probe(), as it would overwrite the probe
+                * deferral reason recorded in rcar_du_modeset_init().
+                */
                if (ret != -EPROBE_DEFER)
                        dev_err(&pdev->dev,
                                "failed to initialize DRM/KMS (%d)\n", ret);
index 9ff4537..70d8ad0 100644 (file)
@@ -935,7 +935,8 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
        /* Initialize the Color Management Modules. */
        ret = rcar_du_cmm_init(rcdu);
        if (ret)
-               return ret;
+               return dev_err_probe(rcdu->dev, ret,
+                                    "failed to initialize CMM\n");
 
        /* Create the CRTCs. */
        for (swindex = 0, hwindex = 0; swindex < rcdu->num_crtcs; ++hwindex) {
@@ -955,7 +956,8 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
        /* Initialize the encoders. */
        ret = rcar_du_encoders_init(rcdu);
        if (ret < 0)
-               return ret;
+               return dev_err_probe(rcdu->dev, ret,
+                                    "failed to initialize encoders\n");
 
        if (ret == 0) {
                dev_err(rcdu->dev, "error: no encoder could be initialized\n");