diff options
author | Dan Carpenter <error27@gmail.com> | 2010-10-12 19:36:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-16 14:13:20 -0400 |
commit | 89980827c7a1e3c2b36895c22c6ef0e92aea6b0c (patch) | |
tree | 84a248d335452737f66912fe61f8ad5e9ac3a7e7 /drivers/net/pch_gbe | |
parent | 35f2516f0a1f9dddb339849c7a07e089322c18c3 (diff) |
pch_gbe: fix if condition in set_settings()
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pch_gbe')
-rw-r--r-- | drivers/net/pch_gbe/pch_gbe_ethtool.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c index e06c6aea4527..c8cc32c0edc9 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, | |||
113 | 113 | ||
114 | pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET); | 114 | pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET); |
115 | 115 | ||
116 | if (ecmd->speed == -1) | 116 | if (ecmd->speed == USHRT_MAX) { |
117 | ecmd->speed = SPEED_1000; | 117 | ecmd->speed = SPEED_1000; |
118 | ecmd->duplex = DUPLEX_FULL; | 118 | ecmd->duplex = DUPLEX_FULL; |
119 | } | ||
119 | ret = mii_ethtool_sset(&adapter->mii, ecmd); | 120 | ret = mii_ethtool_sset(&adapter->mii, ecmd); |
120 | if (ret) { | 121 | if (ret) { |
121 | pr_err("Error: mii_ethtool_sset\n"); | 122 | pr_err("Error: mii_ethtool_sset\n"); |