media: mediatek: vcodec: destroy core workqueue on remove
Subsystems (4)
PATCH 1/1 media: mediatek: vcodec: destroy core workqueue on remove
The decoder probe allocates core_workqueue for latency-based decoder architectures. The probe failure paths destroy the workqueue, but the normal remove path only destroys decode_workqueue.
As a result, removing a latency-based decoder leaves core_workqueue allocated after the device lifetime has ended.
Destroy core_workqueue during remove for latency-based decoder architectures, matching the cleanup performed by the probe failure paths.
This issue was found by manual code inspection.
--- .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +2 -0
@@ -570,6 +570,8 @@ static void mtk_vcodec_dec_remove(struct platform_device *pdev)struct mtk_vcodec_dec_dev *dev =platform_get_drvdata (pdev);destroy_workqueue (dev->decode_workqueue); +if (IS_VDEC_LAT_ARCH (dev->vdec_pdata->hw_arch)) +destroy_workqueue (dev->core_workqueue);if (media_devnode_is_registered (dev->mdev_dec.devnode)) {media_device_unregister (&dev->mdev_dec);
Signature · 1 line
2.43.0
Le mardi 15 septembre 2026 à 19:57 +0800, Guangshuo Li a écrit :
Quoted 5 lines
The decoder probe allocates
core_workqueuefor latency-based decoder architectures. The probe failure paths destroy the workqueue, but the normal remove path only destroysdecode_workqueue.As a result, removing a latency-based decoder leaves
core_workqueue
LAT is an abbreviation to for the core responsible for entropy decoding. I don't know what it translate to, but its not "latency", I'll do the minor edit. It does reduce decoding latency though :-D
Quoted 11 lines
allocated after the device lifetime has ended.
Destroy
core_workqueueduring remove for latency-based decoder architectures, matching the cleanup performed by the probe failure paths.This issue was found by manual code inspection.
Fixes 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode")Signed-off-by Guangshuo Li <[email protected]>
Quoted 17 lines
--- .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 2 ++ 1 file changed, 2 insertions(+)drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +2
-0@@ -570,6 +570,8 @@ static void mtk_vcodec_dec_remove(struct platform_device *pdev)struct mtk_vcodec_dec_dev *dev =platform_get_drvdata (pdev);destroy_workqueue (dev->decode_workqueue); +if (IS_VDEC_LAT_ARCH (dev->vdec_pdata->hw_arch)) +destroy_workqueue (dev->core_workqueue);if (media_devnode_is_registered (dev->mdev_dec.devnode)) {media_device_unregister (&dev->mdev_dec);