diff mbox series

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

Message ID 20200526011505.31884-26-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [01/27] drm: bridge: adv7511: Split EDID read to a separate function | expand

Commit Message

Laurent Pinchart May 26, 2020, 1:15 a.m. UTC
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@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

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: