netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mjr@cs.wisc.edu
To: fbl@redhat.com
Cc: davem@davemloft.net, sboyd@codeaurora.org, ben@simtec.co.uk,
	bhutchings@solarflare.com, netdev@vger.kernel.org,
	Matt Renzelmann <mjr@cs.wisc.edu>
Subject: [PATCH] ks8851: Fix missing mutex_lock/unlock
Date: Thu, 12 Apr 2012 18:15:30 -0500	[thread overview]
Message-ID: <1334272530-11119-1-git-send-email-mjr@cs.wisc.edu> (raw)

From: Matt Renzelmann <mjr@cs.wisc.edu>

All calls to ks8851_rdreg* and ks8851_wrreg* should be protected with
the driver's lock mutex.  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>
---

This modified version incorporates Ben Hutchings' bugfix by removing
the incorrect call to CIDER_REV_GET.

 drivers/net/ethernet/micrel/ks8851.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index c722aa6..e5dc075 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)
 	struct net_device *ndev;
 	struct ks8851_net *ks;
 	int ret;
+	unsigned cider;
 
 	ndev = alloc_etherdev(sizeof(struct ks8851_net));
 	if (!ndev)
@@ -1484,8 +1485,8 @@ static int __devinit ks8851_probe(struct spi_device *spi)
 	ks8851_soft_reset(ks, GRR_GSR);
 
 	/* simple check for a valid chip being connected to the bus */
-
-	if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) {
+	cider = ks8851_rdreg16(ks, KS_CIDER);
+	if ((cider & ~CIDER_REV_MASK) != CIDER_ID) {
 		dev_err(&spi->dev, "failed to read device ID\n");
 		ret = -ENODEV;
 		goto err_id;
@@ -1516,8 +1517,7 @@ static int __devinit ks8851_probe(struct spi_device *spi)
 	}
 
 	netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n",
-		    CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)),
-		    ndev->dev_addr, ndev->irq,
+		    CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq,
 		    ks->rc_ccr & CCR_EEPROM ? "has" : "no");
 
 	return 0;
-- 
1.7.5.4

             reply	other threads:[~2012-04-12 23:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 23:15 mjr [this message]
2012-04-13  0:22 ` [PATCH] ks8851: Fix missing mutex_lock/unlock Flavio Leitner
2012-04-13 17:46 ` Stephen Boyd
  -- strict thread matches above, loose matches on Subject: below --
2012-04-13 17:59 mjr
2012-04-13 18:05 ` David Miller
2012-04-12 21:28 mjr
2012-04-12 22:03 ` Ben Hutchings
2012-04-12 20:06 mjr
2012-04-12 20:34 ` Stephen Boyd
2012-04-12 20:56   ` Matt Renzelmann
2012-04-12 20:59   ` Flavio Leitner
2012-04-12 21:19     ` Flavio Leitner
2012-04-12 20:40 ` Flavio Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334272530-11119-1-git-send-email-mjr@cs.wisc.edu \
    --to=mjr@cs.wisc.edu \
    --cc=ben@simtec.co.uk \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=fbl@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).