From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Yang Subject: [PATCH] ucc_geth: kmalloc casting cleanups Date: Tue, 09 Jan 2007 11:47:39 +0800 Message-ID: <45A3105B.7090302@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org Return-path: Received: from de01egw01.freescale.net ([192.88.165.102]:33603 "EHLO de01egw01.freescale.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbXAIDqg (ORCPT ); Mon, 8 Jan 2007 22:46:36 -0500 Received: from de01smr01.freescale.net (de01smr01.freescale.net [10.208.0.31]) by de01egw01.freescale.net (8.12.11/de01egw01) with ESMTP id l093kZSM022923 for ; Mon, 8 Jan 2007 20:46:35 -0700 (MST) Received: from zch01exm20.fsl.freescale.net (zch01exm20.ap.freescale.net [10.192.129.204]) by de01smr01.freescale.net (8.13.1/8.13.0) with ESMTP id l093kWSM019163 for ; Mon, 8 Jan 2007 21:46:34 -0600 (CST) To: jeff@garzik.org Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Ahmed S. Darwish Switch kmalloc to kzalloc and clean some redundant kmalloc casts. Signed-off-by: Ahmed S. Darwish Signed-off-by: Li Yang --- diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 8243150..0f58f5f 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -2926,10 +2926,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Init Tx bds */ for (j = 0; j < ug_info->numQueuesTx; j++) { /* Setup the skbuff rings */ - ugeth->tx_skbuff[j] = - (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * - ugeth->ug_info->bdRingLenTx[j], - GFP_KERNEL); + ugeth->tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) * + ugeth->ug_info->bdRingLenTx[j], + GFP_KERNEL); if (ugeth->tx_skbuff[j] == NULL) { ugeth_err("%s: Could not allocate tx_skbuff", @@ -2958,10 +2957,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Init Rx bds */ for (j = 0; j < ug_info->numQueuesRx; j++) { /* Setup the skbuff rings */ - ugeth->rx_skbuff[j] = - (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * - ugeth->ug_info->bdRingLenRx[j], - GFP_KERNEL); + ugeth->rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) * + ugeth->ug_info->bdRingLenRx[j], + GFP_KERNEL); if (ugeth->rx_skbuff[j] == NULL) { ugeth_err("%s: Could not allocate rx_skbuff", @@ -3450,19 +3448,16 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) * resource. * This shadow structure keeps a copy of what was done so that the * allocated resources can be released when the channel is freed. + * *p_init_enet_param_shadow is zeroed by kzalloc */ - if (!(ugeth->p_init_enet_param_shadow = - (struct ucc_geth_init_pram *) kmalloc(sizeof(struct ucc_geth_init_pram), - GFP_KERNEL))) { + if (!(ugeth->p_init_enet_param_shadow = + kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { ugeth_err ("%s: Can not allocate memory for" " p_UccInitEnetParamShadows.", __FUNCTION__); ucc_geth_memclean(ugeth); return -ENOMEM; } - /* Zero out *p_init_enet_param_shadow */ - memset((char *)ugeth->p_init_enet_param_shadow, - 0, sizeof(struct ucc_geth_init_pram)); /* Fill shadow InitEnet command parameter structure */