summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-09-15 15:42:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-18 08:40:55 +0200
commit1b5086995e231bd0d9fe71b37ca7a3b6f5786fe3 (patch)
tree3556e23fcd6f75d90c41459e58ca607ad780d32d /drivers/net/phy/phy.c
parente209158d5a566ddb0f2bb10f1fd10ff3ca0974ce (diff)
downloadbarebox-1b5086995e231bd0d9fe71b37ca7a3b6f5786fe3.tar.gz
barebox-1b5086995e231bd0d9fe71b37ca7a3b6f5786fe3.tar.xz
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>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7604e1de33..7813c4903a 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -86,9 +86,7 @@ int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
{
struct phy_fixup *fixup;
- fixup = kzalloc(sizeof(struct phy_fixup), GFP_KERNEL);
- if (!fixup)
- return -ENOMEM;
+ fixup = xzalloc(sizeof(struct phy_fixup));
strlcpy(fixup->bus_id, bus_id, sizeof(fixup->bus_id));
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
* default values */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-
- if (NULL == dev)
- return (struct phy_device*) PTR_ERR((void*)-ENOMEM);
+ dev = xzalloc(sizeof(*dev));
dev->speed = 0;
dev->duplex = -1;