[PATCH 03/22] media: i2c: msp3400-driver: Add missing media_entity_cleanup()

From: Biren Pandya

Date: Sun Jun 14 2026 - 12:58:13 EST


The media_entity_pads_init() function initializes the media entity, but
the driver forgets to call media_entity_cleanup() in the error paths
and remove function. Add the missing calls to fix the API violation and
prevent potential future memory leaks.

Signed-off-by: Biren Pandya <birenpandya@xxxxxxxxx>
---
drivers/media/i2c/msp3400-driver.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
index 4c0b0ad68c08..d977a6039e6c 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -812,6 +812,7 @@ static int msp_probe(struct i2c_client *client)
int err = hdl->error;

v4l2_ctrl_handler_free(hdl);
+ media_entity_cleanup(&sd->entity);
return err;
}

@@ -865,6 +866,7 @@ static void msp_remove(struct i2c_client *client)
msp_reset(client);

v4l2_ctrl_handler_free(&state->hdl);
+ media_entity_cleanup(&state->sd.entity);
}

/* ----------------------------------------------------------------------- */
--
2.50.1 (Apple Git-155)