提交 c1084e02 编写于 作者: A Andrea Merello 提交者: John W. Linville

rtl818x_pci: fix pci probe returns success when it fails

There are several exit path from the PCI probe function.
Some of them, that are taken in case of errors, forget to set the "err"
variable, that is returned by the probe function.
This can lead to the kernel thinking the probe function succeeds while it
didn't, and this in turn causes extra calls to the "remove" function.

This patch fix this problem by ensuring "err" variable is assigned to a proper
non-zero value in each exit path.
Signed-off-by: NAndrea Merello <andrea.merello@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f4cf6287
...@@ -1756,6 +1756,7 @@ static int rtl8180_probe(struct pci_dev *pdev, ...@@ -1756,6 +1756,7 @@ static int rtl8180_probe(struct pci_dev *pdev,
if (!priv->map) { if (!priv->map) {
dev_err(&pdev->dev, "Cannot map device memory/PIO\n"); dev_err(&pdev->dev, "Cannot map device memory/PIO\n");
err = -ENOMEM;
goto err_free_dev; goto err_free_dev;
} }
...@@ -1816,6 +1817,7 @@ static int rtl8180_probe(struct pci_dev *pdev, ...@@ -1816,6 +1817,7 @@ static int rtl8180_probe(struct pci_dev *pdev,
default: default:
printk(KERN_ERR "%s (rtl8180): Unknown chip! (0x%x)\n", printk(KERN_ERR "%s (rtl8180): Unknown chip! (0x%x)\n",
pci_name(pdev), reg >> 25); pci_name(pdev), reg >> 25);
err = -ENODEV;
goto err_iounmap; goto err_iounmap;
} }
...@@ -1866,12 +1868,14 @@ static int rtl8180_probe(struct pci_dev *pdev, ...@@ -1866,12 +1868,14 @@ static int rtl8180_probe(struct pci_dev *pdev,
default: default:
printk(KERN_ERR "%s (rtl8180): Unknown RF! (0x%x)\n", printk(KERN_ERR "%s (rtl8180): Unknown RF! (0x%x)\n",
pci_name(pdev), priv->rf_type); pci_name(pdev), priv->rf_type);
err = -ENODEV;
goto err_iounmap; goto err_iounmap;
} }
if (!priv->rf) { if (!priv->rf) {
printk(KERN_ERR "%s (rtl8180): %s RF frontend not supported!\n", printk(KERN_ERR "%s (rtl8180): %s RF frontend not supported!\n",
pci_name(pdev), rf_name); pci_name(pdev), rf_name);
err = -ENODEV;
goto err_iounmap; goto err_iounmap;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册