* [PATCH] media: tvp5150: Free connectors on probe failure
@ 2026-11-26 5:56 Yige Jiang
0 siblings, 0 replies; only message in thread
From: Yige Jiang @ 2026-11-26 5:56 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Yige Jiang, linux-media, linux-kernel, stable
tvp5150_parse_dt() fills core->connectors[] using
v4l2_fwnode_connector_parse() and v4l2_fwnode_connector_add_link().
Each connector then owns a label string and a list of allocated
links, and each link holds a reference on its local and remote
fwnode. Only tvp5150_remove() releases them with
v4l2_fwnode_connector_free().
Every tvp5150_probe() failure after a successful tvp5150_parse_dt()
skips that release. tvp5150_mc_init() and tvp5150_detect_version()
failures return directly, and the control handler, IRQ and
v4l2_async_register_subdev() failures go to the err label, which only
frees the control handler. Each such failed probe, for example when
the decoder does not respond on I2C, leaks the links, the label and
the fwnode references held by the links.
Free the connectors on these error paths, as tvp5150_remove() does.
Fixes: 0556f1d580d4 ("media: tvp5150: add input source selection of_graph support")
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261109 (630059a5a632).
Compile-tested: arm64, GCC 14.2, W=1, CONFIG_VIDEO_TVP5150=y, CONFIG_MEDIA_CONTROLLER=y, CONFIG_OF_DYNAMIC=y, CONFIG_COMPILE_TEST=y; no new warnings versus the base object.
No hardware or runtime test was performed.
The path is taken when tvp5150_probe() fails after DT parsing, e.g. a DT-described decoder that does not answer on I2C.
drivers/media/i2c/tvp5150.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index c889624..efbb588 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -2158,11 +2158,11 @@ static int tvp5150_probe(struct i2c_client *c)
res = tvp5150_mc_init(core);
if (res)
- return res;
+ goto err_free_connectors;
res = tvp5150_detect_version(core);
if (res < 0)
- return res;
+ goto err_free_connectors;
/*
* Iterate over all available connectors in case they are supported and
@@ -2232,6 +2232,9 @@ static int tvp5150_probe(struct i2c_client *c)
err:
v4l2_ctrl_handler_free(&core->hdl);
+err_free_connectors:
+ for (i = 0; i < core->connectors_num; i++)
+ v4l2_fwnode_connector_free(&core->connectors[i].base);
return res;
}
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-26 5:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 5:56 [PATCH] media: tvp5150: Free connectors on probe failure Yige Jiang
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®