[PATCH 05/22] media: i2c: saa7115: Add missing media_entity_cleanup()
From: Biren Pandya
Date: Sun Jun 14 2026 - 12:59:19 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/saa7115.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 48d6730d9271..64adfff3001b 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1867,6 +1867,7 @@ static int saa711x_probe(struct i2c_client *client)
int err = hdl->error;
v4l2_ctrl_handler_free(hdl);
+ media_entity_cleanup(&sd->entity);
return err;
}
v4l2_ctrl_auto_cluster(2, &state->agc, 0, true);
@@ -1925,6 +1926,7 @@ static void saa711x_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
+ media_entity_cleanup(&sd->entity);
}
static const struct i2c_device_id saa711x_id[] = {
--
2.50.1 (Apple Git-155)