pch_gbe: fix if condition in set_settings()
authorDan Carpenter <error27@gmail.com>
Tue, 12 Oct 2010 23:36:19 +0000 (23:36 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 16 Oct 2010 18:13:20 +0000 (11:13 -0700)
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>
drivers/net/pch_gbe/pch_gbe_ethtool.c

index e06c6aea45271c5d8089e378222f55ef58c57ad0..c8cc32c0edc9678d6174693412e977e43a4ebf29 100644 (file)
@@ -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");