net: tehuti: fix error return code in bdx_probe()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Fri, 5 Mar 2021 02:06:48 +0000 (18:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Mar 2021 20:59:32 +0000 (12:59 -0800)
When bdx_read_mac() fails, no error return code of bdx_probe()
is assigned.
To fix this bug, err is assigned with -EFAULT as error return code.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/tehuti/tehuti.c

index b8f4f419173f974fd6ff1f04a1ab660ba896ebfc..d054c6e83b1c92184fe4b12227aff2ea72d6ad2a 100644 (file)
@@ -2044,6 +2044,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                /*bdx_hw_reset(priv); */
                if (bdx_read_mac(priv)) {
                        pr_err("load MAC address failed\n");
+                       err = -EFAULT;
                        goto err_out_iomap;
                }
                SET_NETDEV_DEV(ndev, &pdev->dev);