Re: kmalloc to kzalloc patches for drivers/atm

From: Dmitry Torokhov
Date: Sun Sep 17 2006 - 21:20:30 EST


On Sunday 17 September 2006 20:53, Om Narasimhan wrote:
> --- a/drivers/atm/firestream.c
> +++ b/drivers/atm/firestream.c
> @@ -1784,7 +1784,7 @@ static int __devinit fs_init (struct fs_
>                 write_fs (dev, RAM, (1 << (28 - FS155_VPI_BITS - FS155_VCI_BITS)) - 1);
>                 dev->nchannels = FS155_NR_CHANNELS;
>         }
> -       dev->atm_vccs = kmalloc (dev->nchannels * sizeof (struct atm_vcc *),
> +       dev->atm_vccs = kzalloc (dev->nchannels * sizeof (struct atm_vcc *),
>                                  GFP_KERNEL);
>         fs_dprintk (FS_DEBUG_ALLOC, "Alloc atmvccs: %p(%Zd)\n",
>                     dev->atm_vccs, dev->nchannels * sizeof (struct atm_vcc *));
>

kcalloc would be better here because you are allocating several objects
at once.

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/