[PATCH 25/27] drm: rcar-du: Fix error handling in rcar_du_encoder_init()

Laurent Pinchart laurent.pinchart+renesas at ideasonboard.com
Tue May 26 01:15:03 UTC 2020


When attaching the bridge returns an error, the rcar_du_encoder_init()
function calls drm_encoder_cleanup() manually instead of jumping to the
error handling path that frees memory. Fix it.

Fixes: c6a27fa41fab ("drm: rcar-du: Convert LVDS encoder code to bridge driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index b0335da0c161..72bf6e2c7933 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -115,8 +115,9 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 	 */
 	ret = drm_bridge_attach(encoder, bridge, NULL, 0);
 	if (ret) {
-		drm_encoder_cleanup(encoder);
-		return ret;
+		dev_err(rcdu->dev, "failed to attach bridge for output %u\n",
+			output);
+		goto done;
 	}
 
 done:
-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list