[KJ] bluetooth drivers : kmalloc to kzalloc conversion

Om Narasimhan om.turyx at gmail.com
Sun Sep 17 19:24:39 PDT 2006


On 9/17/06, Dmitry Torokhov <dtor at insightbb.com> wrote:
> On Sunday 17 September 2006 20:54, Om Narasimhan wrote:
> > --- a/drivers/bluetooth/hci_usb.c
> > +++ b/drivers/bluetooth/hci_usb.c
> > @@ -147,10 +147,9 @@ static struct usb_device_id blacklist_id
> >
> > static struct _urb *_urb_alloc(int isoc, gfp_t gfp)
> > {
> > -struct _urb *_urb = kmalloc(sizeof(struct _urb) +
> > +struct _urb *_urb = kzalloc(sizeof(struct _urb) +
> > sizeof(struct usb_iso_packet_descriptor) * isoc, gfp);
> > if (_urb) {
> > -memset(_urb, 0, sizeof(*_urb));
> > usb_init_urb(&_urb->urb);
> > }
> > return _urb;
> >
>
> Note that only beginning if the aloocated memory was zeroed in original
> code; your patch may introduce slowdowns.
Would it? I thought memset() uses block move operation which doesn't
scale linearly.
And, usb_init_urb() calls memset() anyway, so the previously existed
memset() was superfluous.

Thanks for the comment.
Regards,
Om.



More information about the Kernel-janitors mailing list