mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zixin Wang <w1355457260@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans Verkuil <hverkuil+cisco@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Biren Pandya <birenpandya@gmail.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zixin Wang <w1355457260@gmail.com>
Subject: [PATCH] media: i2c: cx25840: guard media_entity_cleanup() calls
Date: Thu, 12 Nov 2026 16:52:51 +0800	[thread overview]
Message-ID: <20261112085251.734109-1-w1355457260@gmail.com> (raw)

sd->entity only exists when CONFIG_MEDIA_CONTROLLER is enabled, but the
two media_entity_cleanup() calls added by commit 634be628b5cc
("media: i2c: cx25840-core: Add missing media_entity_cleanup()") are
unconditional.  Building with CONFIG_MEDIA_CONTROLLER=n therefore fails:

  drivers/media/i2c/cx25840/cx25840-core.c:3964:41: error:
  'struct v4l2_subdev' has no member named 'entity'

Guard both calls with #if defined(CONFIG_MEDIA_CONTROLLER), matching the
existing media entity setup in cx25840_probe().

The failure was reproduced with CONFIG_MEDIA_CONTROLLER=n.  After the
change the driver builds with both CONFIG_MEDIA_CONTROLLER=n and =y.

AI assistance: the fix and this changelog were drafted with the Qoder
coding assistant; the sender reviewed the change and ran the builds.

Fixes: 634be628b5cc ("media: i2c: cx25840-core: Add missing media_entity_cleanup()")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=222245
Signed-off-by: Zixin Wang <w1355457260@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 7066b2252afd..91794ec59e2d 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.56.1


             reply	other threads:[~2026-11-12  8:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  8:52 Zixin Wang [this message]
2026-11-12  9:12 ` Sakari Ailus

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=20261112085251.734109-1-w1355457260@gmail.com \
    --to=w1355457260@gmail.com \
    --cc=birenpandya@gmail.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /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

all inboxes | Powered by JetHome®