Skip to contentSkip to conversation

pch_gbe: fix if condition in set_settings()

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 13, 2010 – Oct 16, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/net/pch_gbe/pch_gbe_ethtool.c +2 -1
index e06c6ae..c8cc32c 100644
@@ -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");
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Wed, 13 Oct 2010 11:36:19 +0200

Quoted 8 lines

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.

Applied.