[PATCH v2 26/34] staging: mt7621-mmc: Fix unmatched release_mem_regin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Current code calls release_mem_regin on driver remove without
requesting it explicit first. The region is only requested via
devm_ioremap_resource and that releases it automatically. Removing the
release_mem_region calls fixes this.

Signed-off-by: Christian Lütke-Stetzkamp <christian@xxxxxxxx>
---
 drivers/staging/mt7621-mmc/sd.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 85ecb1290afd..ab5d5c864c13 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -2694,10 +2694,9 @@ static void msdc_init_gpd_bd(struct msdc_host *host, struct msdc_dma *dma)
 
 static int msdc_drv_probe(struct platform_device *pdev)
 {
-	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	struct resource *res;
 	__iomem void *base;
 	struct mmc_host *mmc;
-	struct resource *mem;
 	struct msdc_host *host;
 	struct msdc_hw *hw;
 	int ret, irq;
@@ -2713,11 +2712,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	hw   = (struct msdc_hw *)pdev->dev.platform_data;
-	mem  = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq  = platform_get_irq(pdev, 0);
 
 	//BUG_ON((!hw) || (!mem) || (irq < 0)); /* --- by chhung */
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(base)) {
 		ret = PTR_ERR(base);
@@ -2856,9 +2855,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	cancel_delayed_work_sync(&host->card_delaywork);
 #endif
 
-	if (mem)
-		release_mem_region(mem->start, mem->end - mem->start + 1);
-
 host_free:
 	mmc_free_host(mmc);
 
@@ -2870,7 +2866,6 @@ static int msdc_drv_remove(struct platform_device *pdev)
 {
 	struct mmc_host *mmc;
 	struct msdc_host *host;
-	struct resource *mem;
 
 	mmc  = platform_get_drvdata(pdev);
 	BUG_ON(!mmc);
@@ -2894,11 +2889,6 @@ static int msdc_drv_remove(struct platform_device *pdev)
 	dma_free_coherent(NULL, MAX_GPD_NUM * sizeof(struct gpd), host->dma.gpd, host->dma.gpd_addr);
 	dma_free_coherent(NULL, MAX_BD_NUM  * sizeof(struct bd),  host->dma.bd,  host->dma.bd_addr);
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	if (mem)
-		release_mem_region(mem->start, mem->end - mem->start + 1);
-
 	mmc_free_host(host->mmc);
 
 	return 0;
-- 
2.16.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux