amd-xgbe: Incorporate Smatch coding suggestion
authorLendacky, Thomas <Thomas.Lendacky@amd.com>
Thu, 20 Nov 2014 17:03:38 +0000 (11:03 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Nov 2014 20:19:10 +0000 (15:19 -0500)
The Smatch tool indicated that one of the if statements in xgbe-dev.c
could be rewritten to remove a redundant check for the 'err' variable
in an if statement.

Change the statement as suggested and add a comment to help clarify.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/xgbe/xgbe-dev.c

index dcd0347305c0d4f194df76c10806a458191f73ef..72425ffd8d2ba15958465ab41e1a5db3ce9e0595 100644 (file)
@@ -1633,7 +1633,8 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
        etlt = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, ETLT);
        DBGPR("  err=%u, etlt=%#x\n", err, etlt);
 
-       if (!err || (err && !etlt)) {
+       if (!err || !etlt) {
+               /* No error if err is 0 or etlt is 0 */
                if ((etlt == 0x09) &&
                    (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
                        XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,