From d6e9e06861bdd9c57d539578bb7bd2cdd929e638 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20L=C3=BCtke-Stetzkamp?= Date: Wed, 4 Apr 2018 22:15:35 +0200 Subject: [PATCH] staging: mt7621-mmc: Fix unmatched release_mem_regin MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Greg Kroah-Hartman --- 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 @@ release: 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.39.5