netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Small glitch in neptune ethernet driver
Date: Wed, 26 Oct 2011 19:39:27 +0200	[thread overview]
Message-ID: <4EA845CF.6070401@intra2net.com> (raw)

Hi Dave,

consider this piece of code in net/ethernet/sun/niu.c:

static int __devinit phy_record(struct niu_parent *parent,
				struct phy_probe_info *p,
				int dev_id_1, int dev_id_2, u8 phy_port,
				int type)
{
...
	if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) {
		if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) &&
		    ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011) &&
		    ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8706))
			return 0;
	}
...
}

Here are the defines from sun/niu.h:

#define NIU_PHY_ID_MASK         0xfffff0f0
#define NIU_PHY_ID_BCM8704      0x00206030
#define NIU_PHY_ID_BCM8706      0x00206035

There's a zero at the end of the ID_MASK,
so the NIU_PHY_ID_BCM8706 will never match (ends on 5).

Report from cppcheck:
[sun/niu.c:8594]: (style) Mismatching comparison, the result is always true

The code will probably still work as the id for BCM8706
should match on NIU_PHY_ID_BCM8704, too.

Keep it or leave it?

Cheers,
Thomas

             reply	other threads:[~2011-10-26 17:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 17:39 Thomas Jarosch [this message]
2011-12-02  3:00 ` Small glitch in neptune ethernet driver David Miller
2011-12-02  8:49   ` Thomas Jarosch
2011-12-02 17:37     ` David Miller

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=4EA845CF.6070401@intra2net.com \
    --to=thomas.jarosch@intra2net.com \
    --cc=davem@davemloft.net \
    --cc=netdev@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).