[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9235D6609DB808459E95D78E17F2E43D40A654B8@CHN-SV-EXMX02.mchp-main.com>
Date: Mon, 15 May 2017 20:52:25 +0000
From: <Woojung.Huh@...rochip.com>
To: <sergei.shtylyov@...entembedded.com>, <andrew@...n.ch>
CC: <f.fainelli@...il.com>, <vivien.didelot@...oirfairelinux.com>,
<netdev@...r.kernel.org>, <davem@...emloft.net>,
<UNGLinuxDriver@...rochip.com>
Subject: RE: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for
Microchip KSZ9477
> >> + 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
Powered by blists - more mailing lists