> >> +  dev->vlan_cache = devm_kmalloc_array(dev->dev,
> >> +                                       sizeof(struct vlan_table),
> >> +                                       dev->num_vlans, GFP_KERNEL);
> >
> > You should check, but i think devm_kmalloc_array sets the allocated
> > memory to 0.
> 
>     No. Else there would be no need for it, since kcalloc() is a function that
> allocates the arrays and zeroes them.
> 
> > So i don't think you need the memset. If it is needed, i
> > would move it here, after the check the allocation is successful.
> 
>     If it could be done here, kcalloc() should be used.
Andrew & Sergei,

Source shows that devm_kcalloc() calls devm_kmalloc_array() wit __GFP_ZERO.
Will use it instead.

Thanks.
Woojung

Reply via email to