summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/aspeed-video.c
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-11-10 07:23:38 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2019-11-10 07:23:38 +0100
commitc3df30a01da4955e04fa068c503cd784b31dad92 (patch)
tree4f45e39cf79e2ce0c49bc8d62ecc59b43cca6dc7 /drivers/media/platform/aspeed-video.c
parentmedia: dt-bindings: Fix building error for dt_binding_check (diff)
downloadlinux-c3df30a01da4955e04fa068c503cd784b31dad92.tar.xz
linux-c3df30a01da4955e04fa068c503cd784b31dad92.zip
media: aspeed-video: Fix memory leaks in aspeed_video_probe
In the implementation of aspeed_video_probe() the allocated memory for video should be released if either devm_ioremap_resource() or aspeed_video_init() or aspeed_video_setup_video() fails. Replace kzalloc() with devm_kzalloc to avoid explicit release for video. Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Reviewed-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Reviewed-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/platform/aspeed-video.c')
-rw-r--r--drivers/media/platform/aspeed-video.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
index db45502774b1..d8593cb2ae84 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -1657,7 +1657,8 @@ static int aspeed_video_probe(struct platform_device *pdev)
{
int rc;
struct resource *res;
- struct aspeed_video *video = kzalloc(sizeof(*video), GFP_KERNEL);
+ struct aspeed_video *video =
+ devm_kzalloc(&pdev->dev, sizeof(*video), GFP_KERNEL);
if (!video)
return -ENOMEM;