Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1461629

[v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization.

From Arvind Yadav <arvind.yadav.cs@gmail.com>
Newsgroups linux.kernel
Subject [v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization.
Date 2016-08-13 17:40 +0200
Message-ID <s5Jct-38n-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-08-13 17:40 +0200
  Re: [v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization. Heiko Stübner <heiko@sntech.de> - 2016-08-23 18:20 +0200
    Re: [v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock  initialization. arvind Yadav <arvind.yadav.cs@gmail.com> - 2016-08-24 16:30 +0200
      Re: [v.1] clk:clk-rockchip:-of_iomap failed to remap then abort clock initialization. Heiko Stübner <heiko@sntech.de> - 2016-08-24 17:00 +0200

csiph-web