From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: mturquette@baylibre.com, sboyd@codeaurora.org, heiko@sntech.de
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
Arvind Yadav <arvind.yadav.cs@gmail.com>
Subject: [v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization.
Date: Sat, 13 Aug 2016 20:56:18 +0530 [thread overview]
Message-ID: <1471101978-1881-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)
-check return of 'of_iomap'.if It's falied to remap then abort.
-Unmap a region obtained by remap. iounmap frees the mapping when failed
to allocate the memory.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/clk/rockchip/clk-rockchip.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/rockchip/clk-rockchip.c b/drivers/clk/rockchip/clk-rockchip.c
index 4cf838d5..2c9bb81 100644
--- a/drivers/clk/rockchip/clk-rockchip.c
+++ b/drivers/clk/rockchip/clk-rockchip.c
@@ -49,14 +49,19 @@ static void __init rk2928_gate_clk_init(struct device_node *node)
}
reg = of_iomap(node, 0);
+ if (!reg)
+ return;
clk_data = kzalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
- if (!clk_data)
+ if (!clk_data) {
+ iounmap(reg);
return;
+ }
clk_data->clks = kzalloc(qty * sizeof(struct clk *), GFP_KERNEL);
if (!clk_data->clks) {
kfree(clk_data);
+ iounmap(reg);
return;
}
--
2.7.4
next reply other threads:[~2016-08-13 15:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-13 15:26 Arvind Yadav [this message]
2016-08-23 16:15 ` [v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization Heiko Stübner
2016-08-24 14:22 ` arvind Yadav
2016-08-24 14:56 ` Heiko Stübner
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=1471101978-1881-1-git-send-email-arvind.yadav.cs@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.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