* [PATCH] ucc_geth: kmalloc casting cleanups
@ 2007-01-09 3:47 Li Yang
2007-01-09 7:15 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Li Yang @ 2007-01-09 3:47 UTC (permalink / raw)
To: jeff; +Cc: netdev
From: Ahmed S. Darwish <darwish.07@gmail.com>
Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
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 */
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ucc_geth: kmalloc casting cleanups
2007-01-09 3:47 [PATCH] ucc_geth: kmalloc casting cleanups Li Yang
@ 2007-01-09 7:15 ` Jeff Garzik
2007-01-09 7:39 ` Li Yang-r58472
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-01-09 7:15 UTC (permalink / raw)
To: Li Yang; +Cc: netdev, galak
Li Yang wrote:
> From: Ahmed S. Darwish <darwish.07@gmail.com>
>
> Switch kmalloc to kzalloc and clean some redundant kmalloc
> casts.
>
> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
I should wait for Kumar to resend ucc_geth fixes before applying this,
right?
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] ucc_geth: kmalloc casting cleanups
2007-01-09 7:15 ` Jeff Garzik
@ 2007-01-09 7:39 ` Li Yang-r58472
0 siblings, 0 replies; 3+ messages in thread
From: Li Yang-r58472 @ 2007-01-09 7:39 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, galak
> -----Original Message-----
> From: Jeff Garzik [mailto:jeff@garzik.org]
> Sent: Tuesday, January 09, 2007 3:16 PM
> To: Li Yang-r58472
> Cc: netdev@vger.kernel.org; galak@kernel.crashing.org
> Subject: Re: [PATCH] ucc_geth: kmalloc casting cleanups
>
> Li Yang wrote:
> > From: Ahmed S. Darwish <darwish.07@gmail.com>
> >
> > Switch kmalloc to kzalloc and clean some redundant kmalloc
> > casts.
> >
> > Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > ---
>
>
> I should wait for Kumar to resend ucc_geth fixes before applying this,
> right?
Ok. The patch is based on 2.6.20-rc3, but I think it can still apply.
If not, please ping me.
- Leo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-09 7:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-09 3:47 [PATCH] ucc_geth: kmalloc casting cleanups Li Yang
2007-01-09 7:15 ` Jeff Garzik
2007-01-09 7:39 ` Li Yang-r58472
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).