mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Mark Einon <mark.einon@gmail.com>
Subject: [PATCH 1/4] staging: et131x: Remove dead code in isr
Date: Wed,  3 Sep 2014 22:40:54 +0100	[thread overview]
Message-ID: <1409780457-6060-1-git-send-email-mark.einon@gmail.com> (raw)

Dan Carpenter reports:
The patch c2ebf58ba089: "staging: et131x: Implement NAPI support"
from Aug 21, 2014, leads to the following static checker warning:

        drivers/staging/et131x/et131x.c:4004 et131x_isr()
        warn: we tested 'status' before and it was 'true'

We don't actually need the dead code, as we're now using NAPI to
handle enabling interrupts - but we do need to enable interrupts if
NAPI is not scheduled - so enable interrupts if this is the case.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 1037d93..7a1df8a 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -3793,6 +3793,7 @@ static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume);
 static irqreturn_t et131x_isr(int irq, void *dev_id)
 {
 	bool handled = true;
+	bool enable_interrupts = true;
 	struct net_device *netdev = (struct net_device *)dev_id;
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 	struct address_map __iomem *iomem = adapter->regs;
@@ -3802,6 +3803,7 @@ static irqreturn_t et131x_isr(int irq, void *dev_id)
 
 	if (!netif_device_present(netdev)) {
 		handled = false;
+		enable_interrupts = false;
 		goto out;
 	}
 
@@ -3847,8 +3849,10 @@ static irqreturn_t et131x_isr(int irq, void *dev_id)
 		status &= ~ET_INTR_WATCHDOG;
 	}
 
-	if (status & (ET_INTR_RXDMA_XFR_DONE | ET_INTR_TXDMA_ISR))
+	if (status & (ET_INTR_RXDMA_XFR_DONE | ET_INTR_TXDMA_ISR)) {
+		enable_interrupts = false;
 		napi_schedule(&adapter->napi);
+	}
 
 	status &= ~(ET_INTR_TXDMA_ISR | ET_INTR_RXDMA_XFR_DONE);
 
@@ -4001,16 +4005,10 @@ static irqreturn_t et131x_isr(int irq, void *dev_id)
 		 */
 	}
 
-	if (!status) {
-		/* This interrupt has in some way been "handled" by
-		 * the ISR. Either it was a spurious Rx interrupt, or
-		 * it was a Tx interrupt that has been filtered by
-		 * the ISR.
-		 */
+out:
+	if (enable_interrupts)
 		et131x_enable_interrupts(adapter);
-	}
 
-out:
 	return IRQ_RETVAL(handled);
 }
 
@@ -4257,7 +4255,7 @@ static void et131x_multicast(struct net_device *netdev)
 }
 
 /* et131x_tx - The handler to tx a packet on the device */
-static int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device *netdev)
 {
 	int status = 0;
 	struct et131x_adapter *adapter = netdev_priv(netdev);
-- 
2.1.0


             reply	other threads:[~2014-09-03 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 21:40 Mark Einon [this message]
2014-09-03 21:40 ` [PATCH 2/4] staging: et131x: Remove spinlock fbr_lock Mark Einon
2014-09-03 21:40 ` [PATCH 3/4] staging: et131x: Add auto-negotiation and 1000BT_Half as supported protocols Mark Einon
2014-09-03 21:40 ` [PATCH 4/4] staging: et131x: Fix whitespace - alignment matching open parenthesis Mark Einon

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=1409780457-6060-1-git-send-email-mark.einon@gmail.com \
    --to=mark.einon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome