net: phy: Use xzalloc for small allocations
No need to call kzalloc for small allocations, xzalloc will do without the need for an additional check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
e209158d5a
commit
1b5086995e
|
@ -86,9 +86,7 @@ int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
|
||||||
{
|
{
|
||||||
struct phy_fixup *fixup;
|
struct phy_fixup *fixup;
|
||||||
|
|
||||||
fixup = kzalloc(sizeof(struct phy_fixup), GFP_KERNEL);
|
fixup = xzalloc(sizeof(struct phy_fixup));
|
||||||
if (!fixup)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
strlcpy(fixup->bus_id, bus_id, sizeof(fixup->bus_id));
|
strlcpy(fixup->bus_id, bus_id, sizeof(fixup->bus_id));
|
||||||
fixup->phy_uid = phy_uid;
|
fixup->phy_uid = phy_uid;
|
||||||
|
@ -157,10 +155,7 @@ static struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int p
|
||||||
|
|
||||||
/* We allocate the device, and initialize the
|
/* We allocate the device, and initialize the
|
||||||
* default values */
|
* default values */
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
dev = xzalloc(sizeof(*dev));
|
||||||
|
|
||||||
if (NULL == dev)
|
|
||||||
return (struct phy_device*) PTR_ERR((void*)-ENOMEM);
|
|
||||||
|
|
||||||
dev->speed = 0;
|
dev->speed = 0;
|
||||||
dev->duplex = -1;
|
dev->duplex = -1;
|
||||||
|
|
Loading…
Reference in New Issue