]> Pileus Git - ~andy/linux/commitdiff
stmmac: don't return zero on failure path in stmmac_pci_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 1 Feb 2013 12:09:19 +0000 (12:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 3 Feb 2013 21:14:09 +0000 (16:14 -0500)
If stmmac_dvr_probe() fails in stmmac_pci_probe(), it breaks off initialization,
deallocates all resources, but returns zero.
The patch adds -ENODEV as return value in this case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c

index 064eaac9616f59a03e178a259371d1a10c14b7ca..19b3a2567a469f0d27c94349ff117bbae79b5567 100644 (file)
@@ -102,6 +102,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
        priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr);
        if (!priv) {
                pr_err("%s: main driver probe failed", __func__);
+               ret = -ENODEV;
                goto err_out;
        }
        priv->dev->irq = pdev->irq;