[PATCH 01/22] media: i2c: cx25840-core: Add missing media_entity_cleanup()
From: Biren Pandya
Date: Sun Jun 14 2026 - 12:57:01 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/cx25840/cx25840-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 69d5cc648c0f..a3d7473854a3 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -3962,6 +3962,7 @@ static int cx25840_probe(struct i2c_client *client)
int err = state->hdl.error;
v4l2_ctrl_handler_free(&state->hdl);
+ media_entity_cleanup(&sd->entity);
return err;
}
if (!is_cx2583x(state))
@@ -3986,6 +3987,7 @@ static void cx25840_remove(struct i2c_client *client)
cx25840_ir_remove(sd);
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&state->hdl);
+ media_entity_cleanup(&sd->entity);
}
static const struct i2c_device_id cx25840_id[] = {
--
2.50.1 (Apple Git-155)