All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: cx25840: guard entity cleanup
@ 2026-11-29  9:00 pg.radadia
  0 siblings, 0 replies; only message in thread
From: pg.radadia @ 2026-11-29  9:00 UTC (permalink / raw)
  To: linux-media; +Cc: mchehab, Pragnesh Radadiya

From: Pragnesh Radadiya <pg.radadia@gmail.com>

The media entity is initialized only when CONFIG_MEDIA_CONTROLLER is
enabled, but both the probe error path and remove path clean it up
unconditionally. Guard both calls so the driver also builds without
media-controller support.

Tested:
- Build cx25840-core.o with CONFIG_MEDIA_CONTROLLER enabled and disabled
  on v7.3.3 and upstream HEAD.
Signed-off-by: Pragnesh Radadiya <pg.radadia@gmail.com>
---
 drivers/media/i2c/cx25840/cx25840-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 7066b2252..91794ec59 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -3961,7 +3961,9 @@ static int cx25840_probe(struct i2c_client *client)
 		int err = state->hdl.error;
 
 		v4l2_ctrl_handler_free(&state->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
 		media_entity_cleanup(&sd->entity);
+#endif
 		return err;
 	}
 	if (!is_cx2583x(state))
@@ -3986,7 +3988,9 @@ static void cx25840_remove(struct i2c_client *client)
 	cx25840_ir_remove(sd);
 	v4l2_device_unregister_subdev(sd);
 	v4l2_ctrl_handler_free(&state->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
 	media_entity_cleanup(&sd->entity);
+#endif
 }
 
 static const struct i2c_device_id cx25840_id[] = {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29  9:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29  9:00 [PATCH] media: cx25840: guard entity cleanup pg.radadia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.