staging: brcm80211: remove osl_malloced()/MALLOCED()
authormike.rapoport@gmail.com <mike.rapoport@gmail.com>
Tue, 12 Oct 2010 22:09:09 +0000 (00:09 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Oct 2010 19:28:18 +0000 (12:28 -0700)
because there are other means to track memory leaks in kernel

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 files changed:
drivers/staging/brcm80211/brcmfmac/bcmsdh.c
drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/staging/brcm80211/brcmfmac/dhd_linux.c
drivers/staging/brcm80211/include/linux_osl.h
drivers/staging/brcm80211/sys/wl_mac80211.c
drivers/staging/brcm80211/sys/wlc_alloc.c
drivers/staging/brcm80211/sys/wlc_ampdu.c
drivers/staging/brcm80211/sys/wlc_antsel.c
drivers/staging/brcm80211/sys/wlc_channel.c
drivers/staging/brcm80211/sys/wlc_phy_shim.c
drivers/staging/brcm80211/util/hnddma.c
drivers/staging/brcm80211/util/linux_osl.c
drivers/staging/brcm80211/util/nicpci.c
drivers/staging/brcm80211/util/siutils.c

index 3ea64a69deeb14f123ee8f04c5b26ca3f968987e..04d92d15e8e931558d054721c04ff8fa7ff49ef7 100644 (file)
@@ -60,8 +60,7 @@ bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq)
 
        bcmsdh = (bcmsdh_info_t *) MALLOC(osh, sizeof(bcmsdh_info_t));
        if (bcmsdh == NULL) {
-               BCMSDH_ERROR(("bcmsdh_attach: out of memory, "
-                       "malloced %d bytes\n", MALLOCED(osh)));
+               BCMSDH_ERROR(("bcmsdh_attach: out of memory"));
                return NULL;
        }
        bzero((char *)bcmsdh, sizeof(bcmsdh_info_t));
index 2582f3c665fee0f47fe9032cd3ce7456d2e0dc9d..164a752bcc4797b1b1bd0011208b135689bb51f8 100644 (file)
@@ -197,8 +197,7 @@ int bcmsdh_probe(struct device *dev)
        }
        sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t));
        if (!sdhc) {
-               SDLX_MSG(("%s: out of memory, allocated %d bytes\n",
-                         __func__, MALLOCED(osh)));
+               SDLX_MSG(("%s: out of memory\n", __func__));
                goto err;
        }
        bzero(sdhc, sizeof(bcmsdh_hc_t));
@@ -430,8 +429,7 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
        sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t));
        if (!sdhc) {
-               SDLX_MSG(("%s: out of memory, allocated %d bytes\n",
-                         __func__, MALLOCED(osh)));
+               SDLX_MSG(("%s: out of memory\n", __func__));
                goto err;
        }
        bzero(sdhc, sizeof(bcmsdh_hc_t));
index caabf7b563acc44b7beb28392bc58dd9deac387f..22c1e77145319b6bf6290e47019e155bbb9267d0 100644 (file)
@@ -125,8 +125,7 @@ extern sdioh_info_t *sdioh_attach(osl_t *osh, void *bar0, uint irq)
 
        sd = (sdioh_info_t *) MALLOC(osh, sizeof(sdioh_info_t));
        if (sd == NULL) {
-               sd_err(("sdioh_attach: out of memory, malloced %d bytes\n",
-                       MALLOCED(osh)));
+               sd_err(("sdioh_attach: out of memory\n"));
                return NULL;
        }
        bzero((char *)sd, sizeof(sdioh_info_t));
index 9110fbe4f7f100c3bc80fdf53e08daf6543153a1..20a90b2ab66c7fb83a623e19db7e442b5dcadf3b 100644 (file)
@@ -1827,10 +1827,6 @@ osl_t *dhd_osl_attach(void *pdev, uint bustype)
 
 void dhd_osl_detach(osl_t *osh)
 {
-       if (MALLOCED(osh)) {
-               DHD_ERROR(("%s: MEMORY LEAK %d bytes\n", __func__,
-                          MALLOCED(osh)));
-       }
        osl_detach(osh);
 }
 
index 1e1369ed53772fd3deebfadeabfb510389bf3eea..2a8f3f29eed7b42781eda1167ca9d04c4f0f1928 100644 (file)
@@ -96,10 +96,8 @@ typedef struct {
 
 #define MALLOC(osh, size)      osl_malloc((osh), (size))
 #define MFREE(osh, addr, size) osl_mfree((osh), (addr), (size))
-#define MALLOCED(osh)          osl_malloced((osh))
 extern void *osl_malloc(osl_t *osh, uint size);
 extern void osl_mfree(osl_t *osh, void *addr, uint size);
-extern uint osl_malloced(osl_t *osh);
 
 #define NATIVE_MALLOC(osh, size)       kmalloc(size, GFP_ATOMIC)
 #define NATIVE_MFREE(osh, addr, size)  kfree(addr)
index c004a0bcea74170ddadb93c94fc16d1eef10148f..babb678bf82f6e1b3066148e238949a686be2161 100644 (file)
@@ -1615,11 +1615,6 @@ void wl_free(wl_info_t *wl)
        }
 #endif                         /* WLC_HIGH_ONLY */
 
-       if (osl_malloced(osh)) {
-               printf("****   Memory leak of bytes %d\n", osl_malloced(osh));
-               ASSERT(0 && "Memory Leak");
-       }
-
        osl_detach(osh);
 }
 
@@ -1664,7 +1659,7 @@ wl_schedule_task(wl_info_t *wl, void (*fn) (struct wl_task *task),
 
        task = osl_malloc(wl->osh, sizeof(wl_task_t));
        if (!task) {
-               WL_ERROR(("wl%d: wl_schedule_task: out of memory, malloced %d bytes\n", wl->pub->unit, osl_malloced(wl->osh)));
+               WL_ERROR(("wl%d: wl_schedule_task: out of memory\n", wl->pub->unit));
                return -ENOMEM;
        }
 
@@ -1918,7 +1913,7 @@ wl_timer_t *wl_init_timer(wl_info_t *wl, void (*fn) (void *arg), void *arg,
 
        t = osl_malloc(wl->osh, sizeof(wl_timer_t));
        if (!t) {
-               WL_ERROR(("wl%d: wl_init_timer: out of memory, malloced %d bytes\n", wl->pub->unit, osl_malloced(wl->osh)));
+               WL_ERROR(("wl%d: wl_init_timer: out of memory\n", wl->pub->unit));
                return 0;
        }
 
index 9c902d7d051ea6420feba807ef304e991d4e0584..e637e62ebab70702d03a969823ecb5bcd043cb05 100644 (file)
@@ -39,8 +39,7 @@ void *wlc_calloc(osl_t *osh, uint unit, uint size)
 
        item = MALLOC(osh, size);
        if (item == NULL)
-               WL_ERROR(("wl%d: %s: out of memory, malloced %d bytes\n",
-                         unit, __func__, MALLOCED(osh)));
+               WL_ERROR(("wl%d: %s: out of memory\n", unit, __func__));
        else
                bzero((char *)item, size);
        return item;
index 6eed9ee2e4cf9723700483dd33c4192acc298706..99a1357e6a623e337da763603eea89c8e3d1cd6b 100644 (file)
@@ -181,7 +181,7 @@ ampdu_info_t *wlc_ampdu_attach(wlc_info_t *wlc)
 
        ampdu = (ampdu_info_t *) MALLOC(wlc->osh, sizeof(ampdu_info_t));
        if (!ampdu) {
-               WL_ERROR(("wl%d: wlc_ampdu_attach: out of mem, malloced %d bytes\n", wlc->pub->unit, MALLOCED(wlc->osh)));
+               WL_ERROR(("wl%d: wlc_ampdu_attach: out of mem\n", wlc->pub->unit));
                return NULL;
        }
        bzero((char *)ampdu, sizeof(ampdu_info_t));
index cecec8232b2682aa55244dec6192a9c873bcf348..b2e132d1070cbbc623e96c681df94db50a8511d5 100644 (file)
@@ -96,7 +96,7 @@ antsel_info_t *wlc_antsel_attach(wlc_info_t *wlc, osl_t *osh,
 
        asi = (antsel_info_t *) MALLOC(osh, sizeof(antsel_info_t));
        if (!asi) {
-               WL_ERROR(("wl%d: wlc_antsel_attach: out of mem, malloced %d bytes\n", pub->unit, MALLOCED(osh)));
+               WL_ERROR(("wl%d: wlc_antsel_attach: out of mem\n", pub->unit));
                return NULL;
        }
 
index 324de3d6d1c6b493cd862701bc813bd682b9c920..6adb65aed4f9ae84560172250e2467d460a2d0bc 100644 (file)
@@ -614,8 +614,7 @@ wlc_cm_info_t *wlc_channel_mgr_attach(wlc_info_t *wlc)
 
        wlc_cm = (wlc_cm_info_t *) MALLOC(pub->osh, sizeof(wlc_cm_info_t));
        if (wlc_cm == NULL) {
-               WL_ERROR(("wl%d: %s: out of memory, malloced %d bytes",
-                         pub->unit, __func__, MALLOCED(pub->osh)));
+               WL_ERROR(("wl%d: %s: out of memory", pub->unit, __func__));
                return NULL;
        }
        bzero((char *)wlc_cm, sizeof(wlc_cm_info_t));
index 7c8193a3e6a46fc918f2cee4362fa283eed3128f..37bb593815679ee1a1f23881f0b9a140f98e79b0 100644 (file)
@@ -69,7 +69,7 @@ wlc_phy_shim_info_t *wlc_phy_shim_attach(wlc_hw_info_t *wlc_hw,
        physhim = (wlc_phy_shim_info_t *)MALLOC(wlc_hw->osh,
                sizeof(wlc_phy_shim_info_t));
        if (!physhim) {
-               WL_ERROR(("wl%d: wlc_phy_shim_attach: out of mem, malloced %d bytes\n", wlc_hw->unit, MALLOCED(wlc_hw->osh)));
+               WL_ERROR(("wl%d: wlc_phy_shim_attach: out of mem\n", wlc_hw->unit));
                return NULL;
        }
        bzero((char *)physhim, sizeof(wlc_phy_shim_info_t));
index 6f26abc196be3cb9927fb25ffb73f79cf7b1e07f..1c9e598321d3918e4c7171b708ca58c032c731ae 100644 (file)
@@ -381,8 +381,7 @@ hnddma_t *dma_attach(osl_t *osh, char *name, si_t *sih, void *dmaregstx,
        di = MALLOC(osh, sizeof(dma_info_t));
        if (di == NULL) {
 #ifdef BCMDBG
-               printf("dma_attach: out of memory, malloced %d bytes\n",
-                      MALLOCED(osh));
+               printf("dma_attach: out of memory\n");
 #endif
                return NULL;
        }
@@ -517,7 +516,7 @@ hnddma_t *dma_attach(osl_t *osh, char *name, si_t *sih, void *dmaregstx,
                size = ntxd * sizeof(void *);
                di->txp = MALLOC(osh, size);
                if (di->txp == NULL) {
-                       DMA_ERROR(("%s: dma_attach: out of tx memory, malloced %d bytes\n", di->name, MALLOCED(osh)));
+                       DMA_ERROR(("%s: dma_attach: out of tx memory\n", di->name));
                        goto fail;
                }
                bzero((char *)di->txp, size);
@@ -528,7 +527,7 @@ hnddma_t *dma_attach(osl_t *osh, char *name, si_t *sih, void *dmaregstx,
                size = nrxd * sizeof(void *);
                di->rxp = MALLOC(osh, size);
                if (di->rxp == NULL) {
-                       DMA_ERROR(("%s: dma_attach: out of rx memory, malloced %d bytes\n", di->name, MALLOCED(osh)));
+                       DMA_ERROR(("%s: dma_attach: out of rx memory\n", di->name));
                        goto fail;
                }
                bzero((char *)di->rxp, size);
index 7c7d14bc1c2830523e98a9da8b531ee8fa255ce9..92012bc1266817e24b07701101da79c6e118d42e 100644 (file)
@@ -314,12 +314,6 @@ void osl_mfree(osl_t *osh, void *addr, uint size)
        kfree(addr);
 }
 
-uint osl_malloced(osl_t *osh)
-{
-       ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
-       return osh->malloced;
-}
-
 uint osl_dma_consistent_align(void)
 {
        return PAGE_SIZE;
index 3a73c826d1ef2a75fd429713ded8534b06ac1153..c48468df324bf80a592a45a9fea05e53beb5348e 100644 (file)
@@ -117,8 +117,7 @@ void *pcicore_init(si_t *sih, osl_t *osh, void *regs)
        /* alloc pcicore_info_t */
        pi = MALLOC(osh, sizeof(pcicore_info_t));
        if (pi == NULL) {
-               PCI_ERROR(("pci_attach: malloc failed! malloced %d bytes\n",
-                          MALLOCED(osh)));
+               PCI_ERROR(("pci_attach: malloc failed!\n"));
                return NULL;
        }
 
index ad74552870d0c933adccc0853acd5e45bfd1bb4c..1c563b065928110e5d89c2f79deea6ef9ebcef23 100644 (file)
@@ -90,8 +90,7 @@ si_t *si_attach(uint devid, osl_t *osh, void *regs, uint bustype, void *sdh,
        /* alloc si_info_t */
        sii = MALLOC(osh, sizeof(si_info_t));
        if (sii == NULL) {
-               SI_ERROR(("si_attach: malloc failed! malloced %d bytes\n",
-                         MALLOCED(osh)));
+               SI_ERROR(("si_attach: malloc failed!\n"));
                return NULL;
        }