[RFC PATCH 01/14] ARM: amba device memory allocation fix

Lorenzo Pieralisi lorenzo.pieralisi at arm.com
Thu Aug 19 04:59:47 EST 2010


When instantiating amba devices dynamically from device tree nodes, the
memory allocation should be carried out using the kzalloc function to make
sure all the members are zero initialized.

This patch replaces the kmalloc call with a kzalloc one.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
---
 drivers/amba/bus.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index d73302c..234f4a3 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -421,7 +421,7 @@ static int amba_add_device_from_node(struct device_node *node)
 	const char *name;
 	int i, ret, len;
 
-	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 		return -ENOMEM;
 
-- 
1.6.3.3



More information about the devicetree-discuss mailing list