提交 89980827 编写于 作者: D Dan Carpenter 提交者: David S. Miller

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: NDan Carpenter <error27@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 35f2516f
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册