Skip to content

Commit

Permalink
mwl8k: don't return zero on failure paths in mwl8k_probe[_hw]()
Browse files Browse the repository at this point in the history
If pci_iomap() fails in mwl8k_probe(), it breaks off initialization,
deallocates all resources, but returns zero.
There is a similar issue when priv->rxd_ops is NULL in mwl8k_probe_hw().

The patch adds proper error code return values.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Alexey Khoroshilov authored and John W. Linville committed Jan 22, 2013
1 parent 7532c7d commit a2ca8ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/wireless/mwl8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -5555,6 +5555,7 @@ static int mwl8k_probe_hw(struct ieee80211_hw *hw)
if (priv->rxd_ops == NULL) {
wiphy_err(hw->wiphy,
"Driver does not have AP firmware image support for this hardware\n");
rc = -ENOENT;
goto err_stop_firmware;
}
} else {
Expand Down Expand Up @@ -5901,6 +5902,7 @@ static int mwl8k_probe(struct pci_dev *pdev,
priv->sram = pci_iomap(pdev, 0, 0x10000);
if (priv->sram == NULL) {
wiphy_err(hw->wiphy, "Cannot map device SRAM\n");
rc = -EIO;
goto err_iounmap;
}

Expand All @@ -5913,6 +5915,7 @@ static int mwl8k_probe(struct pci_dev *pdev,
priv->regs = pci_iomap(pdev, 2, 0x10000);
if (priv->regs == NULL) {
wiphy_err(hw->wiphy, "Cannot map device registers\n");
rc = -EIO;
goto err_iounmap;
}
}
Expand Down

0 comments on commit a2ca8ec

Please sign in to comment.