* [PATCH 01/22] media: i2c: cx25840-core: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 02/22] media: i2c: max9286: " Biren Pandya
` (20 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Hans Verkuil, Bradford Love, linux-kernel
The media_entity_pads_init() function initializes the media entity, but
the driver forgets to call media_entity_cleanup() in the error paths
and remove function. Add the missing calls to fix the API violation and
prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/i2c/cx25840/cx25840-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 69d5cc648c0f..a3d7473854a3 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -3962,6 +3962,7 @@ static int cx25840_probe(struct i2c_client *client)
int err = state->hdl.error;
v4l2_ctrl_handler_free(&state->hdl);
+ media_entity_cleanup(&sd->entity);
return err;
}
if (!is_cx2583x(state))
@@ -3986,6 +3987,7 @@ static void cx25840_remove(struct i2c_client *client)
cx25840_ir_remove(sd);
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&state->hdl);
+ media_entity_cleanup(&sd->entity);
}
static const struct i2c_device_id cx25840_id[] = {
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 02/22] media: i2c: max9286: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
2026-06-14 16:55 ` [PATCH 01/22] media: i2c: cx25840-core: Add missing media_entity_cleanup() Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 03/22] media: i2c: msp3400-driver: " Biren Pandya
` (19 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
Niklas Söderlund, Sakari Ailus, linux-kernel
The media_entity_pads_init() function initializes the media entity, but
the driver forgets to call media_entity_cleanup() in the error paths
and remove function. Add the missing calls to fix the API violation and
prevent potential future memory leaks.
Fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/i2c/max9286.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index ac0712ce1e65..31598fa34c6c 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -1062,7 +1062,7 @@ static int max9286_v4l2_register(struct max9286_priv *priv)
priv->sd.state_lock = priv->ctrls.lock;
ret = v4l2_subdev_init_finalize(&priv->sd);
if (ret)
- goto err_async;
+ goto err_entity;
ret = v4l2_async_register_subdev(&priv->sd);
if (ret < 0) {
@@ -1074,6 +1074,8 @@ static int max9286_v4l2_register(struct max9286_priv *priv)
err_subdev:
v4l2_subdev_cleanup(&priv->sd);
+err_entity:
+ media_entity_cleanup(&priv->sd.entity);
err_async:
v4l2_ctrl_handler_free(&priv->ctrls);
max9286_v4l2_notifier_unregister(priv);
@@ -1087,6 +1089,7 @@ static void max9286_v4l2_unregister(struct max9286_priv *priv)
v4l2_ctrl_handler_free(&priv->ctrls);
v4l2_async_unregister_subdev(&priv->sd);
max9286_v4l2_notifier_unregister(priv);
+ media_entity_cleanup(&priv->sd.entity);
}
/* -----------------------------------------------------------------------------
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 03/22] media: i2c: msp3400-driver: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
2026-06-14 16:55 ` [PATCH 01/22] media: i2c: cx25840-core: Add missing media_entity_cleanup() Biren Pandya
2026-06-14 16:55 ` [PATCH 02/22] media: i2c: max9286: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 04/22] media: i2c: mt9v011: " Biren Pandya
` (18 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab; +Cc: Biren Pandya, linux-kernel
The media_entity_pads_init() function initializes the media entity, but
the driver forgets to call media_entity_cleanup() in the error paths
and remove function. Add the missing calls to fix the API violation and
prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/i2c/msp3400-driver.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
index 4c0b0ad68c08..d977a6039e6c 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -812,6 +812,7 @@ static int msp_probe(struct i2c_client *client)
int err = hdl->error;
v4l2_ctrl_handler_free(hdl);
+ media_entity_cleanup(&sd->entity);
return err;
}
@@ -865,6 +866,7 @@ static void msp_remove(struct i2c_client *client)
msp_reset(client);
v4l2_ctrl_handler_free(&state->hdl);
+ media_entity_cleanup(&state->sd.entity);
}
/* ----------------------------------------------------------------------- */
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 04/22] media: i2c: mt9v011: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (2 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 03/22] media: i2c: msp3400-driver: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 05/22] media: i2c: saa7115: " Biren Pandya
` (17 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab; +Cc: Biren Pandya, Sakari Ailus, linux-kernel
The media_entity_pads_init() function initializes the media entity, but
the driver forgets to call media_entity_cleanup() in the error paths
and remove function. Add the missing calls to fix the API violation and
prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/i2c/mt9v011.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/i2c/mt9v011.c b/drivers/media/i2c/mt9v011.c
index 055b7915260a..b7ef8bff727d 100644
--- a/drivers/media/i2c/mt9v011.c
+++ b/drivers/media/i2c/mt9v011.c
@@ -520,6 +520,7 @@ static int mt9v011_probe(struct i2c_client *c)
(version != MT9V011_REV_B_VERSION)) {
v4l2_info(sd, "*** unknown micron chip detected (0x%04x).\n",
version);
+ media_entity_cleanup(&sd->entity);
return -EINVAL;
}
@@ -542,6 +543,7 @@ static int mt9v011_probe(struct i2c_client *c)
v4l2_err(sd, "control initialization error %d\n", ret);
v4l2_ctrl_handler_free(&core->ctrls);
+ media_entity_cleanup(&sd->entity);
return ret;
}
core->sd.ctrl_handler = &core->ctrls;
@@ -577,6 +579,7 @@ static void mt9v011_remove(struct i2c_client *c)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&core->ctrls);
+ media_entity_cleanup(&sd->entity);
}
/* ----------------------------------------------------------------------- */
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 05/22] media: i2c: saa7115: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (3 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 04/22] media: i2c: mt9v011: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 06/22] media: platform: stm32-csi: " Biren Pandya
` (16 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Hans Verkuil, Yu-Chun Lin, Kuan-Wei Chiu, linux-kernel
The media_entity_pads_init() function initializes the media entity, but
the driver forgets to call media_entity_cleanup() in the error paths
and remove function. Add the missing calls to fix the API violation and
prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/i2c/saa7115.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 48d6730d9271..64adfff3001b 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1867,6 +1867,7 @@ static int saa711x_probe(struct i2c_client *client)
int err = hdl->error;
v4l2_ctrl_handler_free(hdl);
+ media_entity_cleanup(&sd->entity);
return err;
}
v4l2_ctrl_auto_cluster(2, &state->agc, 0, true);
@@ -1925,6 +1926,7 @@ static void saa711x_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
+ media_entity_cleanup(&sd->entity);
}
static const struct i2c_device_id saa711x_id[] = {
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 06/22] media: platform: stm32-csi: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (4 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 05/22] media: i2c: saa7115: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 07/22] media: platform: sun4i_csi: " Biren Pandya
` (15 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Alain Volmat, Maxime Coquelin, Alexandre Torgue,
Hans Verkuil, linux-stm32, linux-arm-kernel, linux-kernel
Fixes: dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/st/stm32/stm32-csi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c
index fd2b6dfbd44c..0847fd347d56 100644
--- a/drivers/media/platform/st/stm32/stm32-csi.c
+++ b/drivers/media/platform/st/stm32/stm32-csi.c
@@ -1060,6 +1060,7 @@ static int stm32_csi_probe(struct platform_device *pdev)
err_cleanup:
v4l2_async_nf_cleanup(&csidev->notifier);
+ media_entity_cleanup(&csidev->sd.entity);
return ret;
}
@@ -1068,6 +1069,7 @@ static void stm32_csi_remove(struct platform_device *pdev)
struct stm32_csi_dev *csidev = platform_get_drvdata(pdev);
v4l2_async_unregister_subdev(&csidev->sd);
+ media_entity_cleanup(&csidev->sd.entity);
pm_runtime_disable(&pdev->dev);
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 07/22] media: platform: sun4i_csi: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (5 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 06/22] media: platform: stm32-csi: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 08/22] media: platform: microchip-isc-scaler: " Biren Pandya
` (14 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Sakari Ailus, linux-arm-kernel, linux-sunxi,
linux-kernel
Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
index e53a07b770b7..f50d97ca795f 100644
--- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
+++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
@@ -242,11 +242,11 @@ static int sun4i_csi_probe(struct platform_device *pdev)
vdev->entity.ops = &sun4i_csi_video_entity_ops;
ret = media_entity_pads_init(&vdev->entity, 1, &csi->vdev_pad);
if (ret < 0)
- return ret;
+ goto err_clean_subdev_entity;
ret = sun4i_csi_dma_register(csi, irq);
if (ret)
- goto err_clean_pad;
+ goto err_clean_vdev_entity;
ret = sun4i_csi_notifier_init(csi);
if (ret)
@@ -266,6 +266,10 @@ static int sun4i_csi_probe(struct platform_device *pdev)
media_device_unregister(&csi->mdev);
sun4i_csi_dma_unregister(csi);
+err_clean_vdev_entity:
+ media_entity_cleanup(&vdev->entity);
+err_clean_subdev_entity:
+ media_entity_cleanup(&subdev->entity);
err_clean_pad:
media_device_cleanup(&csi->mdev);
@@ -282,6 +286,8 @@ static void sun4i_csi_remove(struct platform_device *pdev)
vb2_video_unregister_device(&csi->vdev);
media_device_unregister(&csi->mdev);
sun4i_csi_dma_unregister(csi);
+ media_entity_cleanup(&csi->subdev.entity);
+ media_entity_cleanup(&csi->vdev.entity);
media_device_cleanup(&csi->mdev);
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 08/22] media: platform: microchip-isc-scaler: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (6 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 07/22] media: platform: sun4i_csi: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 09/22] media: platform: cdns-csi2tx: " Biren Pandya
` (13 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Eugen Hristev, Hans Verkuil, Jacopo Mondi, linux-kernel
Fixes: 920b2665f392 ("media: microchip: microchip-isc: prepare for media controller support")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/microchip/microchip-isc-scaler.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/media/platform/microchip/microchip-isc-scaler.c b/drivers/media/platform/microchip/microchip-isc-scaler.c
index e83463543e21..c368c66d9c8b 100644
--- a/drivers/media/platform/microchip/microchip-isc-scaler.c
+++ b/drivers/media/platform/microchip/microchip-isc-scaler.c
@@ -222,6 +222,7 @@ int isc_scaler_init(struct isc_device *isc)
ret = v4l2_device_register_subdev(&isc->v4l2_dev, &isc->scaler_sd);
if (ret < 0) {
dev_err(isc->dev, "scaler sd failed to register subdev\n");
+ media_entity_cleanup(&isc->scaler_sd.entity);
return ret;
}
@@ -229,6 +230,12 @@ int isc_scaler_init(struct isc_device *isc)
}
EXPORT_SYMBOL_GPL(isc_scaler_init);
+void isc_scaler_unregister(struct isc_device *isc)
+{
+ media_entity_cleanup(&isc->scaler_sd.entity);
+}
+EXPORT_SYMBOL_GPL(isc_scaler_unregister);
+
int isc_scaler_link(struct isc_device *isc)
{
int ret;
--
2.50.1 (Apple Git-155)
drivers/media/platform/microchip/microchip-isc-base.c | 1 +
drivers/media/platform/microchip/microchip-isc.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index a7cdc743fda7..27e180aff9a2 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1949,6 +1949,7 @@ EXPORT_SYMBOL_GPL(isc_mc_init);
void isc_mc_cleanup(struct isc_device *isc)
{
+ isc_scaler_unregister(isc);
media_entity_cleanup(&isc->video_dev.entity);
media_device_cleanup(&isc->mdev);
}
diff --git a/drivers/media/platform/microchip/microchip-isc.h b/drivers/media/platform/microchip/microchip-isc.h
index ad4e98a1dd8f..40a54d7d7e10 100644
--- a/drivers/media/platform/microchip/microchip-isc.h
+++ b/drivers/media/platform/microchip/microchip-isc.h
@@ -392,6 +392,7 @@ void microchip_isc_clk_cleanup(struct isc_device *isc);
int isc_scaler_link(struct isc_device *isc);
int isc_scaler_init(struct isc_device *isc);
+void isc_scaler_unregister(struct isc_device *isc);
int isc_mc_init(struct isc_device *isc, u32 ver);
void isc_mc_cleanup(struct isc_device *isc);
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 09/22] media: platform: cdns-csi2tx: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (7 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 08/22] media: platform: microchip-isc-scaler: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 10/22] media: platform: rcar-csi2: " Biren Pandya
` (12 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Maxime Ripard, Benoit Parrot,
Niklas Söderlund, Sakari Ailus, linux-kernel
Fixes: 6f684d4fcce5 ("media: v4l: cadence: Add Cadence MIPI-CSI2 TX driver")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/cadence/cdns-csi2tx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c
index 629b0fa838a2..df1598091d57 100644
--- a/drivers/media/platform/cadence/cdns-csi2tx.c
+++ b/drivers/media/platform/cadence/cdns-csi2tx.c
@@ -620,7 +620,7 @@ static int csi2tx_probe(struct platform_device *pdev)
ret = v4l2_async_register_subdev(&csi2tx->subdev);
if (ret < 0)
- goto err_free_priv;
+ goto err_entity_cleanup;
dev_info(&pdev->dev,
"Probed CSI2TX with %u/%u lanes, %u streams, %s D-PHY\n",
@@ -629,6 +629,8 @@ static int csi2tx_probe(struct platform_device *pdev)
return 0;
+err_entity_cleanup:
+ media_entity_cleanup(&csi2tx->subdev.entity);
err_free_priv:
kfree(csi2tx);
return ret;
@@ -639,6 +641,7 @@ static void csi2tx_remove(struct platform_device *pdev)
struct csi2tx_priv *csi2tx = platform_get_drvdata(pdev);
v4l2_async_unregister_subdev(&csi2tx->subdev);
+ media_entity_cleanup(&csi2tx->subdev.entity);
kfree(csi2tx);
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 10/22] media: platform: rcar-csi2: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (8 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 09/22] media: platform: cdns-csi2tx: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 11/22] media: platform: csisp: " Biren Pandya
` (11 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Niklas Söderlund, Geert Uytterhoeven,
Magnus Damm, linux-renesas-soc, linux-kernel
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/renesas/rcar-csi2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index 7305cc4a04cb..c4e35cac97f4 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -2634,6 +2634,7 @@ static int rcsi2_probe(struct platform_device *pdev)
error_async:
v4l2_async_nf_unregister(&priv->notifier);
v4l2_async_nf_cleanup(&priv->notifier);
+ media_entity_cleanup(&priv->subdev.entity);
return ret;
}
@@ -2646,6 +2647,7 @@ static void rcsi2_remove(struct platform_device *pdev)
v4l2_async_nf_cleanup(&priv->notifier);
v4l2_async_unregister_subdev(&priv->subdev);
v4l2_subdev_cleanup(&priv->subdev);
+ media_entity_cleanup(&priv->subdev.entity);
pm_runtime_disable(&pdev->dev);
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 11/22] media: platform: csisp: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (9 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 10/22] media: platform: rcar-csi2: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 12/22] media: platform: rcar-core: " Biren Pandya
` (10 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Niklas Söderlund, Geert Uytterhoeven,
Magnus Damm, linux-renesas-soc, linux-kernel
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/renesas/rcar-isp/csisp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/renesas/rcar-isp/csisp.c b/drivers/media/platform/renesas/rcar-isp/csisp.c
index 8fb2cc3b5650..51db5ad25c47 100644
--- a/drivers/media/platform/renesas/rcar-isp/csisp.c
+++ b/drivers/media/platform/renesas/rcar-isp/csisp.c
@@ -556,6 +556,7 @@ static int risp_probe(struct platform_device *pdev)
v4l2_async_nf_cleanup(&isp->notifier);
error_pm:
pm_runtime_disable(&pdev->dev);
+ media_entity_cleanup(&isp->subdev.entity);
return ret;
}
@@ -569,6 +570,7 @@ static void risp_remove(struct platform_device *pdev)
v4l2_async_unregister_subdev(&isp->subdev);
v4l2_subdev_cleanup(&isp->subdev);
+ media_entity_cleanup(&isp->subdev.entity);
pm_runtime_disable(&pdev->dev);
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 12/22] media: platform: rcar-core: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (10 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 11/22] media: platform: csisp: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 13/22] media: platform: rzg2l-core: " Biren Pandya
` (9 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Niklas Söderlund, Geert Uytterhoeven,
Magnus Damm, linux-renesas-soc, linux-kernel
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/renesas/rcar-vin/rcar-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
index c8d564aa1eba..a3952bcbcc60 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
@@ -1250,6 +1250,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
rvin_id_put(vin);
err_dma:
rvin_dma_unregister(vin);
+ media_entity_cleanup(&vin->vdev.entity);
return ret;
}
@@ -1274,6 +1275,7 @@ static void rcar_vin_remove(struct platform_device *pdev)
rvin_id_put(vin);
rvin_dma_unregister(vin);
+ media_entity_cleanup(&vin->vdev.entity);
}
static DEFINE_SIMPLE_DEV_PM_OPS(rvin_pm_ops, rvin_suspend, rvin_resume);
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 13/22] media: platform: rzg2l-core: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (11 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 12/22] media: platform: rcar-core: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 14/22] media: platform: cfe: " Biren Pandya
` (8 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Laurent Pinchart, Hans Verkuil, Tommaso Merciai,
Lad Prabhakar, Geert Uytterhoeven, Biju Das, Sakari Ailus,
linux-kernel
Fixes: 07fc05bd0a79 ("media: platform: Add Renesas RZ/G2L CRU driver")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
index 3c5fbd857371..69b69d59a060 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
@@ -300,6 +300,7 @@ static int rzg2l_cru_probe(struct platform_device *pdev)
error_dma_unregister:
rzg2l_cru_dma_unregister(cru);
+ media_entity_cleanup(&cru->vdev.entity);
return ret;
}
@@ -316,6 +317,7 @@ static void rzg2l_cru_remove(struct platform_device *pdev)
mutex_destroy(&cru->mdev_lock);
rzg2l_cru_dma_unregister(cru);
+ media_entity_cleanup(&cru->vdev.entity);
}
static const u16 rzg3e_cru_regs[] = {
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 14/22] media: platform: cfe: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (12 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 13/22] media: platform: rzg2l-core: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 15/22] media: platform: j721e-csi2rx: " Biren Pandya
` (7 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Tomi Valkeinen, Raspberry Pi Kernel Maintenance,
Florian Fainelli, Broadcom internal kernel review list,
Sakari Ailus, Naushir Patuck, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
index 8375ed3e97b9..17c523d32db7 100644
--- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
@@ -2039,6 +2039,7 @@ static int cfe_register_node(struct cfe_device *cfe, int id)
if (ret) {
cfe_err(cfe, "Unable to register video device %s\n",
vdev->name);
+ media_entity_cleanup(&vdev->entity);
return ret;
}
@@ -2064,6 +2065,7 @@ static void cfe_unregister_nodes(struct cfe_device *cfe)
if (check_state(cfe, NODE_REGISTERED, i)) {
clear_state(cfe, NODE_REGISTERED, i);
video_unregister_device(&node->video_dev);
+ media_entity_cleanup(&node->video_dev.entity);
}
}
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 15/22] media: platform: j721e-csi2rx: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (13 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 14/22] media: platform: cfe: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 16/22] media: platform: hantro_drv: " Biren Pandya
` (6 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Jai Luthra, Hans Verkuil, Vaishnav Achath,
Sakari Ailus, Pratyush Yadav, linux-kernel
Fixes: b4a3d877dc92 ("media: ti: Add CSI2RX support for J721E")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
index b75aa363d1bf..b88e3ac3dac8 100644
--- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -1079,13 +1079,16 @@ static int ti_csi2rx_v4l2_init(struct ti_csi2rx_dev *csi)
csi->v4l2_dev.mdev = mdev;
ret = v4l2_device_register(csi->dev, &csi->v4l2_dev);
- if (ret)
+ if (ret) {
+ media_entity_cleanup(&csi->vdev.entity);
return ret;
+ }
ret = media_device_register(mdev);
if (ret) {
v4l2_device_unregister(&csi->v4l2_dev);
media_device_cleanup(mdev);
+ media_entity_cleanup(&csi->vdev.entity);
return ret;
}
@@ -1105,6 +1108,7 @@ static void ti_csi2rx_cleanup_v4l2(struct ti_csi2rx_dev *csi)
media_device_unregister(&csi->mdev);
v4l2_device_unregister(&csi->v4l2_dev);
media_device_cleanup(&csi->mdev);
+ media_entity_cleanup(&csi->vdev.entity);
}
static void ti_csi2rx_cleanup_subdev(struct ti_csi2rx_dev *csi)
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 16/22] media: platform: hantro_drv: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (14 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 15/22] media: platform: j721e-csi2rx: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 17/22] media: pci: saa7134: " Biren Pandya
` (5 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Nicolas Dufresne, Benjamin Gaignard, Philipp Zabel,
linux-rockchip, linux-kernel
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 2e81877f640f..ad71c0402ef3 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -771,8 +771,10 @@ static int hantro_register_entity(struct media_device *mdev,
return ret;
ret = media_device_register_entity(mdev, entity);
- if (ret)
+ if (ret) {
+ media_entity_cleanup(entity);
return ret;
+ }
return 0;
}
@@ -860,12 +862,13 @@ static int hantro_attach_func(struct hantro_dev *vpu,
err_rel_entity2:
media_device_unregister_entity(&func->sink);
-
+ media_entity_cleanup(&func->sink);
err_rel_entity1:
media_device_unregister_entity(&func->proc);
-
+ media_entity_cleanup(&func->proc);
err_rel_entity0:
media_device_unregister_entity(&func->vdev.entity);
+ media_entity_cleanup(&func->vdev.entity);
return ret;
}
@@ -878,6 +881,9 @@ static void hantro_detach_func(struct hantro_func *func)
media_device_unregister_entity(&func->sink);
media_device_unregister_entity(&func->proc);
media_device_unregister_entity(&func->vdev.entity);
+ media_entity_cleanup(&func->sink);
+ media_entity_cleanup(&func->proc);
+ media_entity_cleanup(&func->vdev.entity);
}
static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 17/22] media: pci: saa7134: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (15 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 16/22] media: platform: hantro_drv: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 18/22] media: usb: cx231xx: " Biren Pandya
` (4 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab; +Cc: Biren Pandya, Kees Cook, linux-kernel
The media_entity_pads_init() (or media_entity_init()) function initializes
the media entity, but the driver forgets to call media_entity_cleanup()
in the error paths and remove function. Add the missing calls to fix the
API violation and prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/pci/saa7134/saa7134-core.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c
index 2f5b258d682b..c0e1e8ad55c8 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -798,8 +798,10 @@ static void saa7134_media_release(struct saa7134_dev *dev)
#ifdef CONFIG_MEDIA_CONTROLLER
int i;
- for (i = 0; i < SAA7134_INPUT_MAX + 1; i++)
+ for (i = 0; i < SAA7134_INPUT_MAX + 1; i++) {
media_device_unregister_entity(&dev->input_ent[i]);
+ media_entity_cleanup(&dev->input_ent[i]);
+ }
#endif
}
@@ -836,8 +838,10 @@ static void saa7134_create_entities(struct saa7134_dev *dev)
pr_err("failed to initialize demod pad!\n");
ret = media_device_register_entity(dev->media_dev, &dev->demod);
- if (ret < 0)
+ if (ret < 0) {
pr_err("failed to register demod entity!\n");
+ media_entity_cleanup(&dev->demod);
+ }
dev->decoder = &dev->demod;
} else {
@@ -904,8 +908,10 @@ static void saa7134_create_entities(struct saa7134_dev *dev)
pr_err("failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
- if (ret < 0)
+ if (ret < 0) {
pr_err("failed to register input entity %d!\n", i);
+ media_entity_cleanup(ent);
+ }
}
/* Create input for Radio RF connector */
@@ -923,8 +929,10 @@ static void saa7134_create_entities(struct saa7134_dev *dev)
pr_err("failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
- if (ret < 0)
+ if (ret < 0) {
pr_err("failed to register input entity %d!\n", i);
+ media_entity_cleanup(ent);
+ }
}
}
#endif
@@ -956,6 +964,7 @@ static void saa7134_unregister_video(struct saa7134_dev *dev)
vb2_video_unregister_device(dev->video_dev);
else
video_device_release(dev->video_dev);
+ media_entity_cleanup(&dev->video_dev->entity);
dev->video_dev = NULL;
}
if (dev->vbi_dev) {
@@ -963,6 +972,7 @@ static void saa7134_unregister_video(struct saa7134_dev *dev)
vb2_video_unregister_device(dev->vbi_dev);
else
video_device_release(dev->vbi_dev);
+ media_entity_cleanup(&dev->vbi_dev->entity);
dev->vbi_dev = NULL;
}
if (dev->radio_dev) {
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 18/22] media: usb: cx231xx: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (16 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 17/22] media: pci: saa7134: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 19/22] media: usb: em28xx: " Biren Pandya
` (3 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab; +Cc: Biren Pandya, linux-kernel
The media_entity_pads_init() (or media_entity_init()) function initializes
the media entity, but the driver forgets to call media_entity_cleanup()
in the error paths and remove function. Add the missing calls to fix the
API violation and prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/usb/cx231xx/cx231xx-video.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index 2cd4e333bc4b..2b1ad969e58c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1006,8 +1006,10 @@ void cx231xx_v4l2_create_entities(struct cx231xx *dev)
pr_err("failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
- if (ret < 0)
+ if (ret < 0) {
pr_err("failed to register input entity %d!\n", i);
+ media_entity_cleanup(ent);
+ }
}
#endif
}
@@ -1558,6 +1560,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
video_device_node_name(&dev->vbi_dev));
video_unregister_device(&dev->vbi_dev);
}
+ media_entity_cleanup(&dev->vbi_dev.entity);
if (video_is_registered(&dev->vdev)) {
dev_info(dev->dev, "V4L2 device %s deregistered\n",
video_device_node_name(&dev->vdev));
@@ -1567,6 +1570,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
video_unregister_device(&dev->vdev);
}
+ media_entity_cleanup(&dev->vdev.entity);
v4l2_ctrl_handler_free(&dev->ctrl_handler);
v4l2_ctrl_handler_free(&dev->radio_ctrl_handler);
}
@@ -1839,6 +1843,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
dev_err(dev->dev,
"unable to register video device (error=%i).\n",
ret);
+ media_entity_cleanup(&dev->vdev.entity);
return ret;
}
@@ -1895,6 +1900,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
vbi_nr[dev->devno]);
if (ret < 0) {
dev_err(dev->dev, "unable to register vbi device\n");
+ media_entity_cleanup(&dev->vbi_dev.entity);
return ret;
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 19/22] media: usb: em28xx: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (17 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 18/22] media: usb: cx231xx: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 20/22] media: usb: au0828: " Biren Pandya
` (2 subsequent siblings)
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab; +Cc: Biren Pandya, linux-kernel
The media_entity_pads_init() (or media_entity_init()) function initializes
the media entity, but the driver forgets to call media_entity_cleanup()
in the error paths and remove function. Add the missing calls to fix the
API violation and prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/usb/em28xx/em28xx-video.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 4a0ce9c5ee4b..70baf93aa8f8 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1006,6 +1006,7 @@ static void em28xx_v4l2_media_release(struct em28xx *dev)
if (!INPUT(i)->type)
return;
media_device_unregister_entity(&dev->input_ent[i]);
+ media_entity_cleanup(&dev->input_ent[i]);
}
#endif
}
@@ -1136,9 +1137,11 @@ static void em28xx_v4l2_create_entities(struct em28xx *dev)
"failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
- if (ret < 0)
+ if (ret < 0) {
dev_err(&dev->intf->dev,
"failed to register input entity %d!\n", i);
+ media_entity_cleanup(ent);
+ }
}
if (dev->board.decoder == EM28XX_BUILTIN) {
@@ -1157,8 +1160,10 @@ static void em28xx_v4l2_create_entities(struct em28xx *dev)
dev_err(&dev->intf->dev, "failed to initialize decoder pads %d!\n", ret);
ret = media_device_register_entity(dev->media_dev, v4l2->decoder);
- if (ret < 0)
+ if (ret < 0) {
dev_err(&dev->intf->dev, "failed to register decoder entity %d!\n", ret);
+ media_entity_cleanup(v4l2->decoder);
+ }
}
#endif
@@ -2403,11 +2408,13 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
video_device_node_name(&v4l2->vbi_dev));
video_unregister_device(&v4l2->vbi_dev);
}
+ media_entity_cleanup(&v4l2->vbi_dev.entity);
if (video_is_registered(&v4l2->vdev)) {
dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->vdev));
video_unregister_device(&v4l2->vdev);
}
+ media_entity_cleanup(&v4l2->vdev.entity);
v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
v4l2_device_unregister(&v4l2->v4l2_dev);
@@ -2961,6 +2968,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
if (ret) {
dev_err(&dev->intf->dev,
"unable to register video device (error=%i).\n", ret);
+ media_entity_cleanup(&v4l2->vdev.entity);
goto unregister_dev;
}
@@ -2995,6 +3003,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
if (ret < 0) {
dev_err(&dev->intf->dev,
"unable to register vbi device\n");
+ media_entity_cleanup(&v4l2->vbi_dev.entity);
goto unregister_dev;
}
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 20/22] media: usb: au0828: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (18 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 19/22] media: usb: em28xx: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 21/22] media: usb: dvb-usb-v2: " Biren Pandya
2026-06-14 16:55 ` [PATCH 22/22] media: dvb-frontends: au8522_decoder: " Biren Pandya
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Hans Verkuil, Bradford Love, Chen Ni, linux-kernel
The media_entity_pads_init() (or media_entity_init()) function initializes
the media entity, but the driver forgets to call media_entity_cleanup()
in the error paths and remove function. Add the missing calls to fix the
API violation and prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/usb/au0828/au0828-video.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 3c53105f3d2b..fec4eafd6e30 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -628,6 +628,7 @@ void au0828_usb_v4l2_media_release(struct au0828_dev *dev)
if (AUVI_INPUT(i).type == AU0828_VMUX_UNDEFINED)
return;
media_device_unregister_entity(&dev->input_ent[i]);
+ media_entity_cleanup(&dev->input_ent[i]);
}
#endif
}
@@ -934,7 +935,9 @@ int au0828_analog_unregister(struct au0828_dev *dev)
mutex_lock(&au0828_sysfs_lock);
vb2_video_unregister_device(&dev->vdev);
+ media_entity_cleanup(&dev->vdev.entity);
vb2_video_unregister_device(&dev->vbi_dev);
+ media_entity_cleanup(&dev->vbi_dev.entity);
mutex_unlock(&au0828_sysfs_lock);
v4l2_device_disconnect(&dev->v4l2_dev);
@@ -1907,8 +1910,10 @@ static void au0828_analog_create_entities(struct au0828_dev *dev)
pr_err("failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
- if (ret < 0)
+ if (ret < 0) {
pr_err("failed to register input entity %d!\n", i);
+ media_entity_cleanup(ent);
+ }
}
#endif
}
@@ -2026,6 +2031,7 @@ int au0828_analog_register(struct au0828_dev *dev,
if (retval != 0) {
dprintk(1, "unable to register video device (error = %d).\n",
retval);
+ media_entity_cleanup(&dev->vdev.entity);
return -ENODEV;
}
@@ -2055,6 +2061,8 @@ int au0828_analog_register(struct au0828_dev *dev,
err_reg_vbi_dev:
vb2_video_unregister_device(&dev->vdev);
+ media_entity_cleanup(&dev->vdev.entity);
+ media_entity_cleanup(&dev->vbi_dev.entity);
return ret;
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 21/22] media: usb: dvb-usb-v2: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (19 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 20/22] media: usb: au0828: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
2026-06-14 16:55 ` [PATCH 22/22] media: dvb-frontends: au8522_decoder: " Biren Pandya
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab; +Cc: Biren Pandya, Michael Krufky, linux-kernel
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/usb/dvb-usb-v2/mxl111sf.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
index 870ac3c8b085..0524685e220e 100644
--- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c
+++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c
@@ -900,8 +900,21 @@ static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap)
return ret;
ret = media_device_register_entity(mdev, &state->tuner);
- if (ret)
+ if (ret) {
+ media_entity_cleanup(&state->tuner);
return ret;
+ }
+#endif
+ return 0;
+}
+
+static int mxl111sf_detach_tuner(struct dvb_usb_adapter *adap)
+{
+ struct mxl111sf_state *state = adap_to_priv(adap);
+
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+ media_device_unregister_entity(&state->tuner);
+ media_entity_cleanup(&state->tuner);
#endif
return 0;
}
@@ -1093,6 +1106,7 @@ static struct dvb_usb_device_properties mxl111sf_props_dvbt = {
.i2c_algo = &mxl111sf_i2c_algo,
.frontend_attach = mxl111sf_frontend_attach_dvbt,
.tuner_attach = mxl111sf_attach_tuner,
+ .tuner_detach = mxl111sf_detach_tuner,
.init = mxl111sf_init,
.streaming_ctrl = mxl111sf_ep4_streaming_ctrl,
.get_stream_config = mxl111sf_get_stream_config_dvbt,
@@ -1135,6 +1149,7 @@ static struct dvb_usb_device_properties mxl111sf_props_atsc = {
.i2c_algo = &mxl111sf_i2c_algo,
.frontend_attach = mxl111sf_frontend_attach_atsc,
.tuner_attach = mxl111sf_attach_tuner,
+ .tuner_detach = mxl111sf_detach_tuner,
.init = mxl111sf_init,
.streaming_ctrl = mxl111sf_ep6_streaming_ctrl,
.get_stream_config = mxl111sf_get_stream_config_atsc,
@@ -1177,6 +1192,7 @@ static struct dvb_usb_device_properties mxl111sf_props_mh = {
.i2c_algo = &mxl111sf_i2c_algo,
.frontend_attach = mxl111sf_frontend_attach_mh,
.tuner_attach = mxl111sf_attach_tuner,
+ .tuner_detach = mxl111sf_detach_tuner,
.init = mxl111sf_init,
.streaming_ctrl = mxl111sf_ep5_streaming_ctrl,
.get_stream_config = mxl111sf_get_stream_config_mh,
@@ -1246,6 +1262,7 @@ static struct dvb_usb_device_properties mxl111sf_props_atsc_mh = {
.i2c_algo = &mxl111sf_i2c_algo,
.frontend_attach = mxl111sf_frontend_attach_atsc_mh,
.tuner_attach = mxl111sf_attach_tuner,
+ .tuner_detach = mxl111sf_detach_tuner,
.init = mxl111sf_init,
.streaming_ctrl = mxl111sf_streaming_ctrl_atsc_mh,
.get_stream_config = mxl111sf_get_stream_config_atsc_mh,
@@ -1325,6 +1342,7 @@ static struct dvb_usb_device_properties mxl111sf_props_mercury = {
.i2c_algo = &mxl111sf_i2c_algo,
.frontend_attach = mxl111sf_frontend_attach_mercury,
.tuner_attach = mxl111sf_attach_tuner,
+ .tuner_detach = mxl111sf_detach_tuner,
.init = mxl111sf_init,
.streaming_ctrl = mxl111sf_streaming_ctrl_mercury,
.get_stream_config = mxl111sf_get_stream_config_mercury,
@@ -1396,6 +1414,7 @@ static struct dvb_usb_device_properties mxl111sf_props_mercury_mh = {
.i2c_algo = &mxl111sf_i2c_algo,
.frontend_attach = mxl111sf_frontend_attach_mercury_mh,
.tuner_attach = mxl111sf_attach_tuner,
+ .tuner_detach = mxl111sf_detach_tuner,
.init = mxl111sf_init,
.streaming_ctrl = mxl111sf_streaming_ctrl_mercury_mh,
.get_stream_config = mxl111sf_get_stream_config_mercury_mh,
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 22/22] media: dvb-frontends: au8522_decoder: Add missing media_entity_cleanup()
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
` (20 preceding siblings ...)
2026-06-14 16:55 ` [PATCH 21/22] media: usb: dvb-usb-v2: " Biren Pandya
@ 2026-06-14 16:55 ` Biren Pandya
21 siblings, 0 replies; 22+ messages in thread
From: Biren Pandya @ 2026-06-14 16:55 UTC (permalink / raw)
To: linux-media, mchehab
Cc: Biren Pandya, Hans Verkuil, Bradford Love, linux-kernel
The media_entity_pads_init() (or media_entity_init()) function initializes
the media entity, but the driver forgets to call media_entity_cleanup()
in the error paths and remove function. Add the missing calls to fix the
API violation and prevent potential future memory leaks.
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
drivers/media/dvb-frontends/au8522_decoder.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index 58b959b272c6..9df590603152 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -741,6 +741,7 @@ static int au8522_probe(struct i2c_client *client)
if (hdl->error) {
int err = hdl->error;
+ media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(hdl);
au8522_release_state(state);
return err;
@@ -764,6 +765,7 @@ static void au8522_remove(struct i2c_client *client)
struct v4l2_subdev *sd = i2c_get_clientdata(client);
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
+ media_entity_cleanup(&sd->entity);
au8522_release_state(to_state(sd));
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2026-06-14 16:58 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20260614165630.3896-1-birenpandya@gmail.com>
2026-06-14 16:55 ` [PATCH 01/22] media: i2c: cx25840-core: Add missing media_entity_cleanup() Biren Pandya
2026-06-14 16:55 ` [PATCH 02/22] media: i2c: max9286: " Biren Pandya
2026-06-14 16:55 ` [PATCH 03/22] media: i2c: msp3400-driver: " Biren Pandya
2026-06-14 16:55 ` [PATCH 04/22] media: i2c: mt9v011: " Biren Pandya
2026-06-14 16:55 ` [PATCH 05/22] media: i2c: saa7115: " Biren Pandya
2026-06-14 16:55 ` [PATCH 06/22] media: platform: stm32-csi: " Biren Pandya
2026-06-14 16:55 ` [PATCH 07/22] media: platform: sun4i_csi: " Biren Pandya
2026-06-14 16:55 ` [PATCH 08/22] media: platform: microchip-isc-scaler: " Biren Pandya
2026-06-14 16:55 ` [PATCH 09/22] media: platform: cdns-csi2tx: " Biren Pandya
2026-06-14 16:55 ` [PATCH 10/22] media: platform: rcar-csi2: " Biren Pandya
2026-06-14 16:55 ` [PATCH 11/22] media: platform: csisp: " Biren Pandya
2026-06-14 16:55 ` [PATCH 12/22] media: platform: rcar-core: " Biren Pandya
2026-06-14 16:55 ` [PATCH 13/22] media: platform: rzg2l-core: " Biren Pandya
2026-06-14 16:55 ` [PATCH 14/22] media: platform: cfe: " Biren Pandya
2026-06-14 16:55 ` [PATCH 15/22] media: platform: j721e-csi2rx: " Biren Pandya
2026-06-14 16:55 ` [PATCH 16/22] media: platform: hantro_drv: " Biren Pandya
2026-06-14 16:55 ` [PATCH 17/22] media: pci: saa7134: " Biren Pandya
2026-06-14 16:55 ` [PATCH 18/22] media: usb: cx231xx: " Biren Pandya
2026-06-14 16:55 ` [PATCH 19/22] media: usb: em28xx: " Biren Pandya
2026-06-14 16:55 ` [PATCH 20/22] media: usb: au0828: " Biren Pandya
2026-06-14 16:55 ` [PATCH 21/22] media: usb: dvb-usb-v2: " Biren Pandya
2026-06-14 16:55 ` [PATCH 22/22] media: dvb-frontends: au8522_decoder: " Biren Pandya
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®