Skip to content

Commit

Permalink
pch_gbe: fix if condition in set_settings()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Oct 16, 2010
1 parent 35f2516 commit 8998082
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/pch_gbe/pch_gbe_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 8998082

Please sign in to comment.