net: phy: fix less than zero comparison with unsigned variable val
authorColin Ian King <colin.king@canonical.com>
Thu, 7 May 2020 14:34:30 +0000 (15:34 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 May 2020 01:07:40 +0000 (18:07 -0700)
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>
drivers/net/phy/phy_device.c

index 83fc8e1b579355d3b34bafcfcfda7ebc284ffc71..c3a107cf578e142ddd632a58c780d1dfb7ef922e 100644 (file)
@@ -1948,7 +1948,7 @@ static int genphy_setup_master_slave(struct phy_device *phydev)
 static int genphy_read_master_slave(struct phy_device *phydev)
 {
        int cfg, state;
-       u16 val;
+       int val;
 
        if (!phydev->is_gigabit_capable) {
                phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;