media: amphion: lock and check m2m_ctx in event handler
authorMing Qian <ming.qian@nxp.com>
Mon, 21 Nov 2022 06:34:42 +0000 (06:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:17 +0000 (13:32 +0100)
commitc9411d57c1de5673c5cc6d14fbf802ae7c96bdfb
treeff2cd86597c1a1892ed62c896aeac2c913e202fe
parentc0c1903e87336aeb4d455580f9170635ebe0246f
media: amphion: lock and check m2m_ctx in event handler

[ Upstream commit 1ade3f3f16986cd7c6fce02feede957f03eb8a42 ]

driver needs to cancel vpu before releasing the vpu instance,
so call v4l2_m2m_ctx_release() first,
to handle the redundant event triggered after m2m_ctx is released.

lock and check m2m_ctx in the event handler.

Fixes: 3cd084519c6f ("media: amphion: add vpu v4l2 m2m support")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/amphion/vpu_msgs.c
drivers/media/platform/amphion/vpu_v4l2.c