media: chips-media: wave5: Fix Potential Probe Resource Leak

After kthread creation during probe sequence, a handful of other
failures could occur. If this were to happen, the kthread is never
explicitly deleted which results in a resource leak. Add explicit cleanup
of this resource.

Signed-off-by: Brandon Brnich <b-brnich@ti.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Brandon Brnich
2025-12-16 15:34:13 -06:00
committed by Hans Verkuil
parent 8e30a27f4a
commit 336367fab9

View File

@@ -362,7 +362,7 @@ static int wave5_vpu_probe(struct platform_device *pdev)
ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
if (ret) {
dev_err(&pdev->dev, "v4l2_device_register, fail: %d\n", ret);
goto err_vdi_release;
goto err_irq_release;
}
if (match_data->flags & WAVE5_IS_DEC) {
@@ -407,7 +407,15 @@ static int wave5_vpu_probe(struct platform_device *pdev)
wave5_vpu_dec_unregister_device(dev);
err_v4l2_unregister:
v4l2_device_unregister(&dev->v4l2_dev);
err_irq_release:
if (dev->irq < 0)
kthread_destroy_worker(dev->worker);
err_vdi_release:
if (dev->irq_thread) {
kthread_stop(dev->irq_thread);
up(&dev->irq_sem);
dev->irq_thread = NULL;
}
wave5_vdi_release(&pdev->dev);
err_clk_dis:
clk_bulk_disable_unprepare(dev->num_clks, dev->clks);