Skip to contentSkip to conversation

Cleanup: Use kcalloc instead of custom local function.

PATCH New Panagiotis Issaris 1 participant 1 message Nov 8, 2005 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Cleanup: Use kcalloc instead of custom local function.

Cleanup: The statically defined ckmalloc is only used once in the sourcefile and it can easily be replaced by kcalloc.

---

 drivers/char/sx.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

applies-to: 83b352286b6bd3b144b5f9ce337f70505719a088 f3ccf337c07daf203f997608bb528d84ee8388d7

drivers/char/sx.c +1 -13
index 3ad758a..fead587 100644
@@ -2279,18 +2279,6 @@ static int sx_init_drivers(void)
 	return 0;
 }
 
-
-static void * ckmalloc (int size)
-{
-	void *p;
-
-	p = kmalloc(size, GFP_KERNEL);
-	if (p) 
-		memset(p, 0, size);
-	return p;
-}
-
-
 static int sx_init_portstructs (int nboards, int nports)
 {
 	struct sx_board *board;
@@ -2303,7 +2291,7 @@ static int sx_init_portstructs (int nboa
 
 	/* Many drivers statically allocate the maximum number of ports
 	   There is no reason not to allocate them dynamically. Is there? -- REW */
-	sx_ports          = ckmalloc(nports * sizeof (struct sx_port));
+	sx_ports = kcalloc(nports, sizeof (struct sx_port), GFP_KERNEL);
 	if (!sx_ports)
 		return -ENOMEM;
 

---
0.99.9.GIT