media: mtk-vcodec: Fix an error handling path in 'mtk_vcodec_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 11 Nov 2021 13:17:51 +0000 (14:17 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 30 Nov 2021 11:07:53 +0000 (12:07 +0100)
In case of error the 'media_device_init()' call is not balanced by a
corresponding 'media_device_cleanup()' call.

Add it, when needed, as already done in the remove function.

Fixes: 118add98f80e ("media: mtk-vcodec: vdec: add media device if using stateless api")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c

index 68abb14..5d72fce 100644 (file)
@@ -358,6 +358,8 @@ err_media_reg:
        if (dev->vdec_pdata->uses_stateless_api)
                v4l2_m2m_unregister_media_controller(dev->m2m_dev_dec);
 err_reg_cont:
+       if (dev->vdec_pdata->uses_stateless_api)
+               media_device_cleanup(&dev->mdev_dec);
        destroy_workqueue(dev->decode_workqueue);
 err_event_workq:
        v4l2_m2m_release(dev->m2m_dev_dec);