[PATCH v2 2/2] media: i2c: saa7115: Guard media_entity_cleanup() calls
From: Paulo Ravazzano
Date: Tue Nov 17 2026 - 20:44:13 EST
The entity member of struct v4l2_subdev is only defined when
CONFIG_MEDIA_CONTROLLER is enabled, so the unconditional
media_entity_cleanup(&sd->entity) calls added by commit 6787d5189e32
break the build when CONFIG_MEDIA_CONTROLLER is disabled.
Guard both calls with #if defined(CONFIG_MEDIA_CONTROLLER).
An AI agent was used to find the bug. The correction was done manually.
Fixes: 6787d5189e32 ("media: i2c: saa7115: Add missing media_entity_cleanup()")
Signed-off-by: Paulo Ravazzano <paulo.ravazzano@xxxxxxxxx>
---
drivers/media/i2c/saa7115.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index f4015f113..32c526df1 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1868,7 +1868,9 @@ static int saa711x_probe(struct i2c_client *client)
int err = hdl->error;
v4l2_ctrl_handler_free(hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity);
+#endif
return err;
}
v4l2_ctrl_auto_cluster(2, &state->agc, 0, true);
@@ -1927,7 +1929,9 @@ static void saa711x_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
+#if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&sd->entity);
+#endif
}
static const struct i2c_device_id saa711x_id[] = {
--
2.56.1