aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2013-01-02 15:06:47 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-01-07 15:16:59 -0500
commit6960af6dce1f0b2d9d1b4ddf75952d54e633b923 (patch)
tree0ba3d4a06fdd882d1e327ad49c5e1860b601d6de /drivers/net/wireless/p54
parent40a23296854dded596fda33e0df4a7373229d75e (diff)
p54pci: don't return zero on failure paths in p54p_probe()
If pci_set_dma_mask() or pci_set_consistent_dma_mask() fails in p54p_probe(), it breaks off initialization, deallocates all resources, but returns zero. Similar issue is if check for returned value of pci_resource_len() fails. The patch implements proper error code propagation. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Acked-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r--drivers/net/wireless/p54/p54pci.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 933e5d941937..57e3af8ebb4b 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -559,6 +559,7 @@ static int p54p_probe(struct pci_dev *pdev,
559 mem_len = pci_resource_len(pdev, 0); 559 mem_len = pci_resource_len(pdev, 0);
560 if (mem_len < sizeof(struct p54p_csr)) { 560 if (mem_len < sizeof(struct p54p_csr)) {
561 dev_err(&pdev->dev, "Too short PCI resources\n"); 561 dev_err(&pdev->dev, "Too short PCI resources\n");
562 err = -ENODEV;
562 goto err_disable_dev; 563 goto err_disable_dev;
563 } 564 }
564 565
@@ -568,8 +569,10 @@ static int p54p_probe(struct pci_dev *pdev,
568 goto err_disable_dev; 569 goto err_disable_dev;
569 } 570 }
570 571
571 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || 572 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
572 pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { 573 if (!err)
574 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
575 if (err) {
573 dev_err(&pdev->dev, "No suitable DMA available\n"); 576 dev_err(&pdev->dev, "No suitable DMA available\n");
574 goto err_free_reg; 577 goto err_free_reg;
575 } 578 }