aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/smsc9420.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-02-24 03:50:29 -0800
committerDavid S. Miller <davem@davemloft.net>2009-02-24 03:50:29 -0800
commite70049b9e74267dd47e1ffa62302073487afcb48 (patch)
tree2cd000c0751ef31c9044b020d63f278cdf4f332d /drivers/net/smsc9420.c
parentd18921a0e319ab512f8186b1b1142c7b8634c779 (diff)
parentf7e603ad8f78cd3b59e33fa72707da0cbabdf699 (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'drivers/net/smsc9420.c')
-rw-r--r--drivers/net/smsc9420.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index da8b977a535..17560dbcc7a 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -341,7 +341,7 @@ static int smsc9420_eeprom_send_cmd(struct smsc9420_pdata *pd, u32 op)
do {
msleep(1);
e2cmd = smsc9420_reg_read(pd, E2P_CMD);
- } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (timeout--));
+ } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (--timeout));
if (!timeout) {
smsc_info(HW, "TIMED OUT");
@@ -413,6 +413,7 @@ static int smsc9420_ethtool_get_eeprom(struct net_device *dev,
}
memcpy(data, &eeprom_data[eeprom->offset], len);
+ eeprom->magic = SMSC9420_EEPROM_MAGIC;
eeprom->len = len;
return 0;
}
@@ -423,6 +424,9 @@ static int smsc9420_ethtool_set_eeprom(struct net_device *dev,
struct smsc9420_pdata *pd = netdev_priv(dev);
int ret;
+ if (eeprom->magic != SMSC9420_EEPROM_MAGIC)
+ return -EINVAL;
+
smsc9420_eeprom_enable_access(pd);
smsc9420_eeprom_send_cmd(pd, E2P_CMD_EPC_CMD_EWEN_);
ret = smsc9420_eeprom_write_location(pd, eeprom->offset, *data);