From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: amd-xgbe: Initial AMD 10GbE platform driver
Date: Wed, 12 Nov 2014 12:03:29 +0000 [thread overview]
Message-ID: <20141112120329.GA12773@mwanda> (raw)
Hello Lendacky, Thomas,
The patch c5aa9e3b8156: "amd-xgbe: Initial AMD 10GbE platform driver"
from Jun 5, 2014, leads to the following Smatch warning:
drivers/net/ethernet/amd/xgbe/xgbe-dev.c:1633 xgbe_dev_read()
warn: we tested 'err' before and it was 'true'
drivers/net/ethernet/amd/xgbe/xgbe-dev.c
1628 /* Check for errors (only valid in last descriptor) */
1629 err = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, ES);
1630 etlt = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, ETLT);
1631 DBGPR(" err=%u, etlt=%#x\n", err, etlt);
1632
1633 if (!err || (err && !etlt)) {
^^^^^^^^^^^^^^^^^^^^^^
Smatch is saying that we could re-write this as:
if (!err || !etlt) {
Which is true, but I'm not sure if that was really the original intent
of the code. If it was then maybe we could make it more explicit by
saying:
if (etlt = 0x00) {
/* do nothing */
} else if (!err) {
if (etlt = 0x09 &&
...
} else {
if (etlt = 0x05 || etlt = 0x06)
...
1634 if ((etlt = 0x09) &&
1635 (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
1636 XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1637 VLAN_CTAG, 1);
1638 packet->vlan_ctag = XGMAC_GET_BITS_LE(rdesc->desc0,
1639 RX_NORMAL_DESC0,
1640 OVT);
1641 DBGPR(" vlan-ctag=0x%04x\n", packet->vlan_ctag);
1642 }
1643 } else {
1644 if ((etlt = 0x05) || (etlt = 0x06))
1645 XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1646 CSUM_DONE, 0);
1647 else
1648 XGMAC_SET_BITS(packet->errors, RX_PACKET_ERRORS,
1649 FRAME, 1);
1650 }
1651
regards,
dan carpenter
next reply other threads:[~2014-11-12 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 12:03 Dan Carpenter [this message]
2014-11-12 12:08 ` amd-xgbe: Initial AMD 10GbE platform driver Dan Carpenter
2014-11-12 16:57 ` Tom Lendacky
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=20141112120329.GA12773@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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;
as well as URLs for NNTP newsgroup(s).