Commit 9c673d15 authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller

cxgb4: Use vmalloc, if kmalloc fails

Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ac5fe75
...@@ -851,7 +851,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e, ...@@ -851,7 +851,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
{ {
int i, err = 0; int i, err = 0;
struct adapter *adapter = netdev2adap(dev); struct adapter *adapter = netdev2adap(dev);
u8 *buf = kmalloc(EEPROMSIZE, GFP_KERNEL); u8 *buf = t4_alloc_mem(EEPROMSIZE);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
...@@ -862,7 +862,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e, ...@@ -862,7 +862,7 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
if (!err) if (!err)
memcpy(data, buf + e->offset, e->len); memcpy(data, buf + e->offset, e->len);
kfree(buf); t4_free_mem(buf);
return err; return err;
} }
...@@ -891,7 +891,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -891,7 +891,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
if (aligned_offset != eeprom->offset || aligned_len != eeprom->len) { if (aligned_offset != eeprom->offset || aligned_len != eeprom->len) {
/* RMW possibly needed for first or last words. /* RMW possibly needed for first or last words.
*/ */
buf = kmalloc(aligned_len, GFP_KERNEL); buf = t4_alloc_mem(aligned_len);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
err = eeprom_rd_phys(adapter, aligned_offset, (u32 *)buf); err = eeprom_rd_phys(adapter, aligned_offset, (u32 *)buf);
...@@ -919,7 +919,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -919,7 +919,7 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
err = t4_seeprom_wp(adapter, true); err = t4_seeprom_wp(adapter, true);
out: out:
if (buf != data) if (buf != data)
kfree(buf); t4_free_mem(buf);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment