]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mdio: mux: fix an incorrect less than zero error check using a u32
authorColin Ian King <colin.king@canonical.com>
Mon, 5 Jun 2017 18:08:04 +0000 (19:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Jun 2017 21:45:51 +0000 (17:45 -0400)
The u32 variable v is being checked to see if an error return is
less than zero and this check has no effect because it is unsigned.
Fix this by making v and int (this also matches the type of
cb->bus_number which is assigned to the value in v).

Detected by CoverityScan, CID#1440454 ("Unsigned compared against zero")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio-mux.c

index 47ded39040501ac756b9bffa7e4057f1fc1aa6a8..00755b6a42cf1960e0a60bc95b72685afaee987e 100644 (file)
@@ -133,7 +133,7 @@ int mdio_mux_init(struct device *dev,
 
        ret_val = -ENODEV;
        for_each_available_child_of_node(dev->of_node, child_bus_node) {
-               u32 v;
+               int v;
 
                v = of_mdio_parse_addr(dev, child_bus_node);
                if (v < 0) {