Skip to contentSkip to conversation

media: mediatek: vcodec: destroy core workqueue on remove

PATCH In review Guangshuo Li 2 participants 2 messages Sep 15 – Sep 29

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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.

Fixes 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode")
---
 .../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
index e936ed8dffba..426d060d937c 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw

Le mardi 15 septembre 2026 à 19:57 +0800, Guangshuo Li a écrit :

Quoted 5 lines

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

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_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.

Fixes 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode")
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
index e936ed8dffba..426d060d937c 100644
@@ -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);