diff mbox

clk: st: clk-flexgen: Unmap region obtained by of_iomap

Message ID 57d92940.6329c80a.3d959.9d78@mx.google.com (mailing list archive)
State Changes Requested, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

Arvind Yadav Sept. 14, 2016, 10:38 a.m. UTC
From: Arvind Yadav <arvind.yadav.cs@gmail.com>

Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/clk/st/clk-flexgen.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Stephen Boyd Sept. 14, 2016, 6:24 p.m. UTC | #1
On 09/14, arvind.yadav.cs@gmail.com wrote:
> @@ -337,6 +339,8 @@ static void __init st_of_flexgen_setup(struct device_node *np)
>  	return;
>  
>  err:
> +	if (reg)

This is always true? Why check?

> +		iounmap(reg);
>  	if (clk_data)
>  		kfree(clk_data->clks);
>  	kfree(clk_data);
> -- 
> 1.7.9.5
>
Arvind Yadav Sept. 19, 2016, 5:44 p.m. UTC | #2
On Wednesday 14 September 2016 11:54 PM, Stephen Boyd wrote:
> On 09/14, arvind.yadav.cs@gmail.com wrote:
>> @@ -337,6 +339,8 @@ static void __init st_of_flexgen_setup(struct device_node *np)
>>   	return;
>>   
>>   err:
>> +	if (reg)
> This is always true? Why check?
> I have removed this check. Please review updated patch.
>> +		iounmap(reg);
>>   	if (clk_data)
>>   		kfree(clk_data->clks);
>>   	kfree(clk_data);
>> -- 
>> 1.7.9.5
>>

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 546bd79..af8df7b 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -278,8 +278,10 @@  static void __init st_of_flexgen_setup(struct device_node *np)
 		return;
 
 	parents = flexgen_get_parents(np, &num_parents);
-	if (!parents)
+	if (!parents) {
+		iounmap(reg);
 		return;
+	}
 
 	clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
 	if (!clk_data)
@@ -337,6 +339,8 @@  static void __init st_of_flexgen_setup(struct device_node *np)
 	return;
 
 err:
+	if (reg)
+		iounmap(reg);
 	if (clk_data)
 		kfree(clk_data->clks);
 	kfree(clk_data);