diff mbox series

[next] drm/omap: clean up error exit path on omap_encoder allocation failure

Message ID 20241015141012.155559-1-colin.i.king@gmail.com (mailing list archive)
State New
Headers show
Series [next] drm/omap: clean up error exit path on omap_encoder allocation failure | expand

Commit Message

Colin Ian King Oct. 15, 2024, 2:10 p.m. UTC
Currently when an allocation failure occurs for omap_encoder the exit
path will destroy encoder via omap_encoder_destroy  if it is not null.
However, encoder is always null at this point, so the check and destroy
is redundant and can be removed. Clean up the code by removing the exit
path and redundant omap_encoder_destroy call, and just return NULL.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/gpu/drm/omapdrm/omap_encoder.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 4dd05bc732da..a99022638a2c 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -126,21 +126,15 @@  struct drm_encoder *omap_encoder_init(struct drm_device *dev,
 
 	omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL);
 	if (!omap_encoder)
-		goto fail;
+		return NULL;
 
 	omap_encoder->output = output;
 
 	encoder = &omap_encoder->base;
 
 	drm_encoder_init(dev, encoder, &omap_encoder_funcs,
 			 DRM_MODE_ENCODER_TMDS, NULL);
 	drm_encoder_helper_add(encoder, &omap_encoder_helper_funcs);
 
 	return encoder;
-
-fail:
-	if (encoder)
-		omap_encoder_destroy(encoder);
-
-	return NULL;
 }