diff options
Diffstat (limited to 'drivers/clk/mvebu/common.c')
-rw-r--r-- | drivers/clk/mvebu/common.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c index adaa4a1821b8..25ceccf939ad 100644 --- a/drivers/clk/mvebu/common.c +++ b/drivers/clk/mvebu/common.c | |||
@@ -45,8 +45,10 @@ void __init mvebu_coreclk_setup(struct device_node *np, | |||
45 | clk_data.clk_num = 2 + desc->num_ratios; | 45 | clk_data.clk_num = 2 + desc->num_ratios; |
46 | clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *), | 46 | clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *), |
47 | GFP_KERNEL); | 47 | GFP_KERNEL); |
48 | if (WARN_ON(!clk_data.clks)) | 48 | if (WARN_ON(!clk_data.clks)) { |
49 | iounmap(base); | ||
49 | return; | 50 | return; |
51 | } | ||
50 | 52 | ||
51 | /* Register TCLK */ | 53 | /* Register TCLK */ |
52 | of_property_read_string_index(np, "clock-output-names", 0, | 54 | of_property_read_string_index(np, "clock-output-names", 0, |
@@ -134,7 +136,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np, | |||
134 | 136 | ||
135 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 137 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
136 | if (WARN_ON(!ctrl)) | 138 | if (WARN_ON(!ctrl)) |
137 | return; | 139 | goto ctrl_out; |
138 | 140 | ||
139 | spin_lock_init(&ctrl->lock); | 141 | spin_lock_init(&ctrl->lock); |
140 | 142 | ||
@@ -145,10 +147,8 @@ void __init mvebu_clk_gating_setup(struct device_node *np, | |||
145 | ctrl->num_gates = n; | 147 | ctrl->num_gates = n; |
146 | ctrl->gates = kzalloc(ctrl->num_gates * sizeof(struct clk *), | 148 | ctrl->gates = kzalloc(ctrl->num_gates * sizeof(struct clk *), |
147 | GFP_KERNEL); | 149 | GFP_KERNEL); |
148 | if (WARN_ON(!ctrl->gates)) { | 150 | if (WARN_ON(!ctrl->gates)) |
149 | kfree(ctrl); | 151 | goto gates_out; |
150 | return; | ||
151 | } | ||
152 | 152 | ||
153 | for (n = 0; n < ctrl->num_gates; n++) { | 153 | for (n = 0; n < ctrl->num_gates; n++) { |
154 | const char *parent = | 154 | const char *parent = |
@@ -160,4 +160,10 @@ void __init mvebu_clk_gating_setup(struct device_node *np, | |||
160 | } | 160 | } |
161 | 161 | ||
162 | of_clk_add_provider(np, clk_gating_get_src, ctrl); | 162 | of_clk_add_provider(np, clk_gating_get_src, ctrl); |
163 | |||
164 | return; | ||
165 | gates_out: | ||
166 | kfree(ctrl); | ||
167 | ctrl_out: | ||
168 | iounmap(base); | ||
163 | } | 169 | } |