From 7a6cb0d5497418599d2125b670926b75e673861c Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 13 May 2010 22:00:05 +0200 Subject: Staging: Use kcalloc or kzalloc Use kcalloc or kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,y,flags; statement S; type T; @@ x = - kmalloc + kcalloc ( - y * sizeof(T), + y, sizeof(T), flags); if (x == NULL) S -memset(x, 0, y * sizeof(T)); @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // Signed-off-by: Julia Lawall --- drivers/staging/rtl8192u/r8192U_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u/r8192U_core.c') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index cbbc7d3..2bede27 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2251,13 +2251,11 @@ short rtl8192_usb_initendpoints(struct net_device *dev) #endif memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB); - priv->pp_rxskb = kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, + priv->pp_rxskb = kcalloc(MAX_RX_URB, sizeof(struct sk_buff *), GFP_KERNEL); if (priv->pp_rxskb == NULL) goto destroy; - memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB); - goto _middle; -- cgit v1.1