net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 25 Sep 2019 11:05:54 +0000 (14:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Sep 2019 08:21:44 +0000 (10:21 +0200)
The "gmac->phy_mode" variable is an enum and in this context GCC will
treat it as an unsigned int so the error handling will never be
triggered.

Fixes: b1c17215d718 ("stmmac: add ipq806x glue layer")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c

index 2c6d7c69c8f741c22c9c55306c04bc920355e0d8..0d21082ceb93d1d0b0e2fb1e7edbb6653ab76385 100644 (file)
@@ -191,7 +191,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)
        struct device *dev = &gmac->pdev->dev;
 
        gmac->phy_mode = of_get_phy_mode(dev->of_node);
-       if (gmac->phy_mode < 0) {
+       if ((int)gmac->phy_mode < 0) {
                dev_err(dev, "missing phy mode property\n");
                return -EINVAL;
        }