qtnfmac: fix uninitialized return code in ret
authorColin Ian King <colin.king@canonical.com>
Wed, 21 Jun 2017 13:25:30 +0000 (14:25 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 28 Jun 2017 17:50:12 +0000 (20:50 +0300)
The return value ret is unitialized and garbage is being returned
for the three different error conditions when setting up the PCIe
BARs. Fix this by initializing ret to  -ENOMEM to indicate that
the BARs failed to be setup correctly.

Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c

index f93b27f3a2360e6c2e527a22537c39ba6c8c4e3e..7fc4f0d6a9ad384f80c248cc3cccf5fad9bbf378 100644 (file)
@@ -247,7 +247,7 @@ static void qtnf_pcie_free_shm_ipc(struct qtnf_pcie_bus_priv *priv)
 
 static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
 {
-       int ret;
+       int ret = -ENOMEM;
 
        priv->sysctl_bar = qtnf_map_bar(priv, QTN_SYSCTL_BAR);
        if (IS_ERR_OR_NULL(priv->sysctl_bar)) {