From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: mchehab@kernel.org
Cc: gregkh@linuxfoundation.org, linux-media@vger.kernel.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Staging: media: Unmap and release region obtained by ioremap_nocache
Date: Fri, 17 Mar 2017 12:21:23 +0530 [thread overview]
Message-ID: <1489733483-11186-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)
Free memory mapping, if vpfe_ipipe_init is not successful.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index ff47a8f3..6a3434c 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1803,14 +1803,14 @@ void vpfe_ipipe_unregister_entities(struct vpfe_ipipe_device *vpfe_ipipe)
return -EBUSY;
ipipe->base_addr = ioremap_nocache(res->start, res_len);
if (!ipipe->base_addr)
- return -EBUSY;
+ goto error_release;
res = platform_get_resource(pdev, IORESOURCE_MEM, 6);
if (!res)
- return -ENOENT;
+ goto error_unmap;
ipipe->isp5_base_addr = ioremap_nocache(res->start, res_len);
if (!ipipe->isp5_base_addr)
- return -EBUSY;
+ goto error_unmap;
v4l2_subdev_init(sd, &ipipe_v4l2_ops);
sd->internal_ops = &ipipe_v4l2_internal_ops;
@@ -1839,6 +1839,12 @@ void vpfe_ipipe_unregister_entities(struct vpfe_ipipe_device *vpfe_ipipe)
sd->ctrl_handler = &ipipe->ctrls;
return media_entity_pads_init(me, IPIPE_PADS_NUM, pads);
+
+error_unmap:
+ iounmap(ipipe->base_addr);
+error_release:
+ release_mem_region(res->start, res_len);
+ return -ENOMEM;
}
/*
--
1.9.1
reply other threads:[~2017-03-17 6:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489733483-11186-1-git-send-email-arvind.yadav.cs@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).