aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Beregalov <a.beregalov@gmail.com>2011-03-13 14:58:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-14 15:22:54 -0400
commit570edd3b2337a94b4159aa9ff10e0b96c5a69ec2 (patch)
tree0946e41fcdf28d3a952955f7111e6c10ee4839f4
parentab42abf33a3efdf754710a0a513c00c40854cd61 (diff)
staging: brcm80211: fix memory leaks
Free resources before exit. Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_sdio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index a6da7268d87a..106627040db0 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -5641,6 +5641,10 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
5641 unsigned char *ularray; 5641 unsigned char *ularray;
5642 5642
5643 ularray = kmalloc(bus->ramsize, GFP_ATOMIC); 5643 ularray = kmalloc(bus->ramsize, GFP_ATOMIC);
5644 if (!ularray) {
5645 bcmerror = BCME_NOMEM;
5646 goto err;
5647 }
5644 /* Upload image to verify downloaded contents. */ 5648 /* Upload image to verify downloaded contents. */
5645 offset = 0; 5649 offset = 0;
5646 memset(ularray, 0xaa, bus->ramsize); 5650 memset(ularray, 0xaa, bus->ramsize);
@@ -5652,7 +5656,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
5652 DHD_ERROR(("%s: error %d on reading %d membytes" 5656 DHD_ERROR(("%s: error %d on reading %d membytes"
5653 " at 0x%08x\n", 5657 " at 0x%08x\n",
5654 __func__, bcmerror, MEMBLOCK, offset)); 5658 __func__, bcmerror, MEMBLOCK, offset));
5655 goto err; 5659 goto free;
5656 } 5660 }
5657 5661
5658 offset += MEMBLOCK; 5662 offset += MEMBLOCK;
@@ -5666,7 +5670,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
5666 DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n", 5670 DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n",
5667 __func__, bcmerror, 5671 __func__, bcmerror,
5668 sizeof(dlarray) - offset, offset)); 5672 sizeof(dlarray) - offset, offset));
5669 goto err; 5673 goto free;
5670 } 5674 }
5671 } 5675 }
5672 5676
@@ -5674,11 +5678,11 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
5674 DHD_ERROR(("%s: Downloaded image is corrupted.\n", 5678 DHD_ERROR(("%s: Downloaded image is corrupted.\n",
5675 __func__)); 5679 __func__));
5676 ASSERT(0); 5680 ASSERT(0);
5677 goto err; 5681 goto free;
5678 } else 5682 } else
5679 DHD_ERROR(("%s: Download/Upload/Compare succeeded.\n", 5683 DHD_ERROR(("%s: Download/Upload/Compare succeeded.\n",
5680 __func__)); 5684 __func__));
5681 5685free:
5682 kfree(ularray); 5686 kfree(ularray);
5683 } 5687 }
5684#endif /* DHD_DEBUG */ 5688#endif /* DHD_DEBUG */