Re: [PATCH v3 3/4] media: renesas: rcar-core: Add missing media_entity_cleanup()
Jacopo Mondi <[email protected]>
| Newsgroups | org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media |
|---|---|
| Message-ID | <ak5z6XBqAuJumxek@zed> |
Hi Biren On Sat, Jul 04, 2026 at 11:16:42PM +0530, Biren Pandya wrote: > The probe error path and the remove function fail to call > media_entity_cleanup() upon teardown. > > While currently a no-op in most cases, calling media_entity_cleanup() > is an API requirement for entities initialized with media_entity_pads_init() > to prevent memory leaks. > > Add the missing media_entity_cleanup() calls. Furthermore, introduce a > dedicated err_entity label in the probe error path to ensure the cleanup > is only invoked if media_entity_pads_init() has successfully completed. Same comments as per the other patches Reviewed-by: Jacopo Mondi <[email protected]> > Signed-off-by: Biren Pandya <[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 c8d564aa1eba..5bae8eb0ee19 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) > >