[PATCH v6 3/4] media: renesas: rcar-core: Add missing media_entity_cleanup()
Biren Pandya <[email protected]>
| Newsgroups | org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media |
|---|---|
| Message-ID | <[email protected]> |
The probe error path and remove function fail to call media_entity_cleanup() upon teardown. While currently a no-op, calling media_entity_cleanup() is an API requirement for entities initialized with media_entity_pads_init() to prevent memory leaks. Add a dedicated error_entity label so the cleanup is only invoked when media_entity_pads_init() has actually succeeded. This ensures that the teardown logic properly mirrors initialization. Signed-off-by: Biren Pandya <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> --- drivers/media/platform/renesas/rcar-vin/rcar-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index c8d564aa1eba8..5bae8eb0ee19b 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -1211,7 +1211,7 @@ static int rcar_vin_probe(struct platform_device *pdev) ret = rvin_create_controls(vin); if (ret < 0) - goto err_id; + goto err_entity; switch (vin->info->model) { case RCAR_GEN3: @@ -1246,6 +1246,8 @@ static int rcar_vin_probe(struct platform_device *pdev) err_ctrl: rvin_free_controls(vin); +err_entity: + media_entity_cleanup(&vin->vdev.entity); err_id: rvin_id_put(vin); err_dma: @@ -1270,6 +1272,7 @@ static void rcar_vin_remove(struct platform_device *pdev) rvin_group_put(vin); rvin_free_controls(vin); + media_entity_cleanup(&vin->vdev.entity); rvin_id_put(vin); -- 2.50.1 (Apple Git-155)