From: Dan Carpenter <error27@gmail.com>
To: netdev@vger.kernel.org
Cc: Masayuki Ohtake <masa-korg@dsn.okisemi.com>,
"David S. Miller" <davem@davemloft.net>,
kernel-janitors@vger.kernel.org
Subject: [patch -next] pch_gbe: fix if condition in set_settings()
Date: Wed, 13 Oct 2010 11:36:19 +0200 [thread overview]
Message-ID: <20101013093619.GC6060@bicker> (raw)
There were no curly braces in this if condition so it always enabled full
duplex.
And ecmd->speed is an unsigned short so it is never equal to -1. The
effect is that mii_ethtool_sset() fails with -EINVAL and an error is
printed to dmesg.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
index e06c6ae..c8cc32c 100644
--- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
+++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
@@ -113,9 +113,10 @@ static int pch_gbe_set_settings(struct net_device *netdev,
pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET);
- if (ecmd->speed == -1)
+ if (ecmd->speed == USHRT_MAX) {
ecmd->speed = SPEED_1000;
ecmd->duplex = DUPLEX_FULL;
+ }
ret = mii_ethtool_sset(&adapter->mii, ecmd);
if (ret) {
pr_err("Error: mii_ethtool_sset\n");
next reply other threads:[~2010-10-13 9:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 9:36 Dan Carpenter [this message]
2010-10-16 18:55 ` [patch -next] pch_gbe: fix if condition in set_settings() 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=20101013093619.GC6060@bicker \
--to=error27@gmail.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=masa-korg@dsn.okisemi.com \
--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).