Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: fix less than zero comparison with unsigned variable val

The unsigned variable val is being checked for an error by checking
if it is less than zero. This can never occur because val is unsigned.
Fix this by making val a plain int.

Addresses-Coverity: ("Unsigned compared against zero")
Fixes: bdbdac7649fa ("ethtool: provide UAPI for PHY master/slave configuration.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Colin Ian King and committed by
David S. Miller
3a13f98b ca7e3edc

+1 -1
+1 -1
drivers/net/phy/phy_device.c
··· 1948 1948 static int genphy_read_master_slave(struct phy_device *phydev) 1949 1949 { 1950 1950 int cfg, state; 1951 - u16 val; 1951 + int val; 1952 1952 1953 1953 if (!phydev->is_gigabit_capable) { 1954 1954 phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;