aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorMatt Renzelmann <mjr@cs.wisc.edu>2012-04-13 03:59:40 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-13 14:04:47 -0400
commit51c61a2838c33dab7b6659b9a3e008bb1b40bc9b (patch)
treea5bb998aa71933a045d43bcca7bac5a8a78478cb /drivers/net/ethernet
parent59a54f3082b9847c1240e24879750e3a03f96754 (diff)
ks8851: Fix missing mutex_lock/unlock
Move the ks8851_rdreg16 call above the call to request_irq and cache the result for subsequent repeated use. A spurious interrupt may otherwise cause a crash. Thanks to Stephen Boyd, Flavio Leitner, and Ben Hutchings for feedback. Signed-off-by: Matt Renzelmann <mjr@cs.wisc.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index c722aa607d07..e5dc0757f077 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -1418,6 +1418,7 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1418 struct net_device *ndev; 1418 struct net_device *ndev;
1419 struct ks8851_net *ks; 1419 struct ks8851_net *ks;
1420 int ret; 1420 int ret;
1421 unsigned cider;
1421 1422
1422 ndev = alloc_etherdev(sizeof(struct ks8851_net)); 1423 ndev = alloc_etherdev(sizeof(struct ks8851_net));
1423 if (!ndev) 1424 if (!ndev)
@@ -1484,8 +1485,8 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1484 ks8851_soft_reset(ks, GRR_GSR); 1485 ks8851_soft_reset(ks, GRR_GSR);
1485 1486
1486 /* simple check for a valid chip being connected to the bus */ 1487 /* simple check for a valid chip being connected to the bus */
1487 1488 cider = ks8851_rdreg16(ks, KS_CIDER);
1488 if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { 1489 if ((cider & ~CIDER_REV_MASK) != CIDER_ID) {
1489 dev_err(&spi->dev, "failed to read device ID\n"); 1490 dev_err(&spi->dev, "failed to read device ID\n");
1490 ret = -ENODEV; 1491 ret = -ENODEV;
1491 goto err_id; 1492 goto err_id;
@@ -1516,8 +1517,7 @@ static int __devinit ks8851_probe(struct spi_device *spi)
1516 } 1517 }
1517 1518
1518 netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", 1519 netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n",
1519 CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), 1520 CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq,
1520 ndev->dev_addr, ndev->irq,
1521 ks->rc_ccr & CCR_EEPROM ? "has" : "no"); 1521 ks->rc_ccr & CCR_EEPROM ? "has" : "no");
1522 1522
1523 return 0; 1523 return 0;