net: wireless: bcm4329: Fix memleak in dev->p
authorAndrei Warkentin <andreiw@motorola.com>
Sat, 12 Feb 2011 01:01:28 +0000 (17:01 -0800)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:07:12 +0000 (12:07 -0800)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcm4329/bcmsdh_linux.c
drivers/net/wireless/bcm4329/bcmsdh_sdmmc_linux.c

index 3b7da42..1e33555 100644 (file)
@@ -301,7 +301,7 @@ int bcmsdh_remove(struct device *dev)
        MFREE(osh, sdhc, sizeof(bcmsdh_hc_t));
        osl_detach(osh);
 
-#if !defined(BCMLXSDMMC)
+#if !defined(BCMLXSDMMC) || defined(OOB_INTR_ONLY)
        dev_set_drvdata(dev, NULL);
 #endif /* !defined(BCMLXSDMMC) */
 
@@ -647,10 +647,12 @@ void bcmsdh_unregister_oob_intr(void)
 {
        SDLX_MSG(("%s: Enter\n", __FUNCTION__));
 
-       set_irq_wake(sdhcinfo->oob_irq, 0);
-       disable_irq(sdhcinfo->oob_irq); /* just in case.. */
-       free_irq(sdhcinfo->oob_irq, NULL);
-       sdhcinfo->oob_irq_registered = FALSE;
+       if (sdhcinfo->oob_irq_registered) {
+               set_irq_wake(sdhcinfo->oob_irq, 0);
+               disable_irq(sdhcinfo->oob_irq); /* just in case.. */
+               free_irq(sdhcinfo->oob_irq, NULL);
+               sdhcinfo->oob_irq_registered = FALSE;
+       }
 }
 #endif /* defined(OOB_INTR_ONLY) */
 /* Module parameters specific to each host-controller driver */
index 8992a42..5a1a46c 100644 (file)
@@ -82,7 +82,6 @@ PBCMSDH_SDMMC_INSTANCE gInstance;
 
 extern int bcmsdh_probe(struct device *dev);
 extern int bcmsdh_remove(struct device *dev);
-struct device sdmmc_dev;
 
 static int bcmsdh_sdmmc_probe(struct sdio_func *func,
                               const struct sdio_device_id *id)
@@ -102,7 +101,7 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
                if(func->device == 0x4) { /* 4318 */
                        gInstance->func[2] = NULL;
                        sd_trace(("NIC found, calling bcmsdh_probe...\n"));
-                       ret = bcmsdh_probe(&sdmmc_dev);
+                       ret = bcmsdh_probe(&func->dev);
                }
        }
 
@@ -110,7 +109,7 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
 
        if (func->num == 2) {
                sd_trace(("F2 found, calling bcmsdh_probe...\n"));
-               ret = bcmsdh_probe(&sdmmc_dev);
+               ret = bcmsdh_probe(&func->dev);
        }
 
        return ret;
@@ -126,7 +125,7 @@ static void bcmsdh_sdmmc_remove(struct sdio_func *func)
 
        if (func->num == 2) {
                sd_trace(("F2 found, calling bcmsdh_remove...\n"));
-               bcmsdh_remove(&sdmmc_dev);
+               bcmsdh_remove(&func->dev);
        }
 }
 
@@ -250,10 +249,8 @@ int sdio_function_init(void)
        if (!gInstance)
                return -ENOMEM;
 
-       bzero(&sdmmc_dev, sizeof(sdmmc_dev));
        error = sdio_register_driver(&bcmsdh_sdmmc_driver);
 
-
        return error;
 }
 
@@ -265,7 +262,6 @@ void sdio_function_cleanup(void)
 {
        sd_trace(("%s Enter\n", __FUNCTION__));
 
-
        sdio_unregister_driver(&bcmsdh_sdmmc_driver);
 
        if (gInstance)