Skip to contentSkip to conversation

ARM: pxa: ssp: remove unnessary free for devm_xxx

PATCH Superseded Firo Yang 2 participants 2 messages Jun 8, 2015

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Firo Yang

author
#0 lore raw

PATCH 1/1 ARM: pxa: ssp: remove unnessary free for devm_xxx

A Coccinelle warning.
It's not necessary to free memory allocated with devm_xxx and using these free functions maybe lead to a double free that will corrupt the resource subsys. So, I just remove them.

---
 arch/arm/plat-pxa/ssp.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm/plat-pxa/ssp.c +0 -8
index ad9529c..f3f1431 100644
@@ -239,18 +239,10 @@ static int pxa_ssp_remove(struct platform_device *pdev)
 	if (ssp = NULL)
 		return -ENODEV;
 
-	iounmap(ssp->mmio_base);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, resource_size(res));
-
-	clk_put(ssp->clk);
-
 	mutex_lock(&ssp_lock);
 	list_del(&ssp->node);
 	mutex_unlock(&ssp_lock);
 
-	kfree(ssp);
 	return 0;
 }
 
Signature · 1 line
2.4.2
#1 lore raw
Quoted 4 lines · Firo Yang

A Coccinelle warning.
It's not necessary to free memory allocated with devm_xxx and using these free functions maybe lead to a double free that will corrupt the resource subsys. So, I just remove them.

This code could also be using devm_ioremap_resource rather than devm_request_mem_region and devm_ioremap.

julia

Quoted 37 lines
---
 arch/arm/plat-pxa/ssp.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm/plat-pxa/ssp.c +0 -9
index ad9529c..f3f1431 100644
@@ -239,18 +239,10 @@ static int pxa_ssp_remove(struct platform_device *pdev)
 	if (ssp = NULL)
 		return -ENODEV;
 
-	iounmap(ssp->mmio_base);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, resource_size(res));
-
-	clk_put(ssp->clk);
-
 	mutex_lock(&ssp_lock);
 	list_del(&ssp->node);
 	mutex_unlock(&ssp_lock);
 
-	kfree(ssp);
 	return 0;
 }
 
--

2.4.2

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html