media: s5p-g2d: Fix a memory leak in an error handling path in 'g2d_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 25 Jun 2020 20:19:47 +0000 (22:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:56 +0000 (08:23 +0200)
commit2cb024f29eb263099dfbb60351dacf9776920975
tree69213b673bf8aaffbbb02fee0a4468cf24c4e945
parent1a1fa600974d891f2a2ef4515ee69216c156717a
media: s5p-g2d: Fix a memory leak in an error handling path in 'g2d_probe()'

[ Upstream commit 94b9ce6870f9c90ac92505482689818b254312f7 ]

Memory allocated with 'v4l2_m2m_init()' must be freed by a corresponding
call to 'v4l2_m2m_release()'

Also reorder the code at the end of the probe function so that
'video_register_device()' is called last.
Update the error handling path accordingly.

Fixes: 5ce60d790a24 ("[media] s5p-g2d: Add DT based discovery support")
Fixes: 918847341af0 ("[media] v4l: add G2D driver for s5p device family")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: checkpatch: align with parenthesis]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/s5p-g2d/g2d.c