]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: hisilicon: Fix signedness bug in hix5hd2_dev_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 25 Sep 2019 10:55:32 +0000 (13:55 +0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 002dfe8085255b7bf1e0758c3d195c5412d35be9 ]

The "priv->phy_mode" variable is an enum and in this context GCC will
treat it as unsigned to the error handling will never trigger.

Fixes: 57c5bc9ad7d7 ("net: hisilicon: add hix5hd2 mac driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c

index aab6fb10af94a3842541e8b5d15a14efedf6d1fc..6adf6831d120afb53c525d096a87cef0471db98d 100644 (file)
@@ -1202,7 +1202,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
                goto err_free_mdio;
 
        priv->phy_mode = of_get_phy_mode(node);
-       if (priv->phy_mode < 0) {
+       if ((int)priv->phy_mode < 0) {
                netdev_err(ndev, "not find phy-mode\n");
                ret = -EINVAL;
                goto err_mdiobus;