media: mtk-jpeg: Fix timeout schedule error in mtk_jpegdec_worker.
authorZheng Wang <zyytlz.wz@163.com>
Mon, 6 Nov 2023 14:48:11 +0000 (15:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Feb 2024 00:18:55 +0000 (16:18 -0800)
commit26f3ae1aa8546db28d9a0ef67b21b17a4dd7e457
treea0191e5771d118a32be31a2b709a7bd4665e35bf
parent9399d61bf561fdd89bbd0f5ab63a69b6eeeeb958
media: mtk-jpeg: Fix timeout schedule error in mtk_jpegdec_worker.

commit 38e1857933def4b3fafc28cc34ff3bbc84cad2c3 upstream.

In mtk_jpegdec_worker, if error occurs in mtk_jpeg_set_dec_dst, it
will start the timeout worker and invoke v4l2_m2m_job_finish at
the same time. This will break the logic of design for there should
be only one function to call v4l2_m2m_job_finish. But now the timeout
handler and mtk_jpegdec_worker will both invoke it.

Fix it by start the worker only if mtk_jpeg_set_dec_dst successfully
finished.

Fixes: da4ede4b7fd6 ("media: mtk-jpeg: move data/code inside CONFIG_OF blocks")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c