media: imx-jpeg: Fix double free in mxc_jpeg_remove
authorMirela Rabulea <mirela.rabulea@nxp.com>
Tue, 6 Apr 2021 17:34:28 +0000 (19:34 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 9 Apr 2021 10:54:49 +0000 (12:54 +0200)
The video_unregister_device already calls video_device_release,
so remove video_device_release, to avoid a double free, when removing
the module. This showed up in a repeated rmmod/insmod scenario.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/imx-jpeg/mxc-jpeg.c

index c720240..03b9264 100644 (file)
@@ -2101,7 +2101,6 @@ static int mxc_jpeg_remove(struct platform_device *pdev)
                mxc_jpeg_free_slot_data(jpeg, slot);
 
        video_unregister_device(jpeg->dec_vdev);
-       video_device_release(jpeg->dec_vdev);
        v4l2_m2m_release(jpeg->m2m_dev);
        v4l2_device_unregister(&jpeg->v4l2_dev);
        mxc_jpeg_detach_pm_domains(jpeg);