From: pg.radadia@gmail.com
To: linux-media@vger.kernel.org
Cc: mchehab@kernel.org, Pragnesh Radadiya <pg.radadia@gmail.com>
Subject: [PATCH] media: cx25840: guard entity cleanup
Date: Sun, 29 Nov 2026 14:30:50 +0530 [thread overview]
Message-ID: <20261129090050.209759-1-pg.radadia@gmail.com> (raw)
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
reply other threads:[~2026-11-29 9:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261129090050.209759-1-pg.radadia@gmail.com \
--to=pg.radadia@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox