From: Peter Huewe <peterhuewe@gmx.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Devendra Naga <devendra.aaru@gmail.com>,
Peter Huewe <peterhuewe@gmx.de>,
Bill Pemberton <wfp5p@virginia.edu>,
Cruz Julian Bishop <cruzjbishop@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] staging/slicoss: Remove always true if statement
Date: Tue, 19 Feb 2013 05:18:49 +0100 [thread overview]
Message-ID: <1361247532-1874-2-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1361247234-1754-1-git-send-email-peterhuewe@gmx.de>
skbtype is assigned once to NORMAL_ETHFRAME and then checked if it is
NORMAL_ETHFRAME -> remove the checks.
This also gets rid of the (false positive) smatch warning:
slicoss.c:2829 slic_xmit_start() error: potential NULL dereference
'hcmd'.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/staging/slicoss/slicoss.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 753993c..048a341 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2786,7 +2786,6 @@ static netdev_tx_t slic_xmit_start(struct sk_buff *skb, struct net_device *dev)
struct adapter *adapter = netdev_priv(dev);
struct slic_hostcmd *hcmd = NULL;
u32 status = 0;
- u32 skbtype = NORMAL_ETHFRAME;
void *offloadcmd = NULL;
card = adapter->card;
@@ -2800,19 +2799,16 @@ static netdev_tx_t slic_xmit_start(struct sk_buff *skb, struct net_device *dev)
goto xmit_fail;
}
- if (skbtype == NORMAL_ETHFRAME) {
- hcmd = slic_cmdq_getfree(adapter);
- if (!hcmd) {
- adapter->xmitq_full = 1;
- status = XMIT_FAIL_HOSTCMD_FAIL;
- goto xmit_fail;
- }
- hcmd->skb = skb;
- hcmd->busy = 1;
- hcmd->type = SLIC_CMD_DUMB;
- if (skbtype == NORMAL_ETHFRAME)
- slic_xmit_build_request(adapter, hcmd, skb);
+ hcmd = slic_cmdq_getfree(adapter);
+ if (!hcmd) {
+ adapter->xmitq_full = 1;
+ status = XMIT_FAIL_HOSTCMD_FAIL;
+ goto xmit_fail;
}
+ hcmd->skb = skb;
+ hcmd->busy = 1;
+ hcmd->type = SLIC_CMD_DUMB;
+ slic_xmit_build_request(adapter, hcmd, skb);
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
@@ -2838,7 +2834,7 @@ static netdev_tx_t slic_xmit_start(struct sk_buff *skb, struct net_device *dev)
xmit_done:
return NETDEV_TX_OK;
xmit_fail:
- slic_xmit_fail(adapter, skb, offloadcmd, skbtype, status);
+ slic_xmit_fail(adapter, skb, offloadcmd, NORMAL_ETHFRAME, status);
goto xmit_done;
}
--
1.7.8.6
next prev parent reply other threads:[~2013-02-19 4:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 4:13 [PATCH 1/5] staging/slicoss: Check pointer before dereferencing Peter Huewe
2013-02-19 4:18 ` Peter Huewe [this message]
2013-02-19 4:18 ` [PATCH 3/5] staging/slicoss: Fix operation may be undefined warning Peter Huewe
2013-02-19 4:18 ` [PATCH 4/5] staging/slicoss: Fix buffer possible overflow in slic_card_locate Peter Huewe
2013-02-19 4:18 ` [PATCH 5/5] staging/slicoss: Use ether_crc for mac hash calculation Peter Huewe
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=1361247532-1874-2-git-send-email-peterhuewe@gmx.de \
--to=peterhuewe@gmx.de \
--cc=cruzjbishop@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=devendra.aaru@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wfp5p@virginia.edu \
/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
all inboxes | Powered by JetHome®