From: Dan Carpenter Date: Tue, 12 Oct 2010 23:36:19 +0000 (+0000) Subject: pch_gbe: fix if condition in set_settings() X-Git-Tag: MMI-PSA29.97-13-9~21994^2~138 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=89980827c7a1e3c2b36895c22c6ef0e92aea6b0c;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: David S. Miller --- 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, 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");