Эх сурвалжийг харах

ARM: sa1111: use devm_kzalloc()

Use devm_kzalloc() to allocate our driver data, so we can eliminate its
kfree() from the device removal and error cleanup paths.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Russell King 9 жил өмнө
parent
commit
7d53c1f012

+ 1 - 3
arch/arm/common/sa1111.c

@@ -696,7 +696,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
 	if (!pd)
 	if (!pd)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL);
+	sachip = devm_kzalloc(me, sizeof(struct sa1111), GFP_KERNEL);
 	if (!sachip)
 	if (!sachip)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
@@ -808,7 +808,6 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
  err_clkput:
  err_clkput:
 	clk_put(sachip->clk);
 	clk_put(sachip->clk);
  err_free:
  err_free:
-	kfree(sachip);
 	return ret;
 	return ret;
 }
 }
 
 
@@ -847,7 +846,6 @@ static void __sa1111_remove(struct sa1111 *sachip)
 
 
 	iounmap(sachip->base);
 	iounmap(sachip->base);
 	clk_put(sachip->clk);
 	clk_put(sachip->clk);
-	kfree(sachip);
 }
 }
 
 
 struct sa1111_save_data {
 struct sa1111_save_data {