]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
media: cadence: csi2rx: Cleanup media entity properly
authorPratyush Yadav <p.yadav@ti.com>
Mon, 9 Oct 2023 13:09:30 +0000 (18:39 +0530)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 12 Oct 2023 07:22:28 +0000 (09:22 +0200)
Call media_entity_cleanup() in probe error path and remove to make sure
the media entity is cleaned up properly.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Tested-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/cadence/cdns-csi2rx.c

index 64e472ca3594fd76ee54b283284c6724bffbc734..399b2f800dc4fd9744dd0927c05fb57e0bb0f3b3 100644 (file)
@@ -547,6 +547,7 @@ static int csi2rx_probe(struct platform_device *pdev)
 err_cleanup:
        v4l2_async_nf_unregister(&csi2rx->notifier);
        v4l2_async_nf_cleanup(&csi2rx->notifier);
+       media_entity_cleanup(&csi2rx->subdev.entity);
 err_free_priv:
        kfree(csi2rx);
        return ret;
@@ -559,6 +560,7 @@ static void csi2rx_remove(struct platform_device *pdev)
        v4l2_async_nf_unregister(&csi2rx->notifier);
        v4l2_async_nf_cleanup(&csi2rx->notifier);
        v4l2_async_unregister_subdev(&csi2rx->subdev);
+       media_entity_cleanup(&csi2rx->subdev.entity);
        kfree(csi2rx);
 }