linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
@ 2011-11-07 16:25 Balaji T K
  2011-11-07 18:29 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Balaji T K @ 2011-11-07 16:25 UTC (permalink / raw)
  To: linux-arm-kernel

From: Per Forlin <per.forlin@linaro.org>

Reported by Russell King:
mmcblk0: error -84 transferring data, sector 149201, nr 64,
cmd response 0x900, card status 0xb00
mmcblk0: retrying using single block read

WARNING: at lib/dma-debug.c:811 check_unmap
omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
it has not allocated [device address=0x0000000080933000] [size=20480 bytes]

In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
and then again in omap_hsmmc_post_req(). Resolve this by clearing the
host_cookie to indicate there is no DMA mapped memory to unmap.

Signed-off-by: Per Forlin <per.forlin@linaro.org>
Tested-by: Balaji T K <balajitk@ti.com>
---
Repost with my Tested-by

 drivers/mmc/host/omap_hsmmc.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 101cd31..d5fe43d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1010,6 +1010,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
 			host->data->sg_len,
 			omap_hsmmc_get_dma_dir(host, host->data));
 		omap_free_dma(dma_ch);
+		host->data->host_cookie = 0;
 	}
 	host->data = NULL;
 }
@@ -1575,8 +1576,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
 	struct mmc_data *data = mrq->data;
 
 	if (host->use_dma) {
-		dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
-			     omap_hsmmc_get_dma_dir(host, data));
+		if (data->host_cookie)
+			dma_unmap_sg(mmc_dev(host->mmc), data->sg,
+				     data->sg_len,
+				     omap_hsmmc_get_dma_dir(host, data));
 		data->host_cookie = 0;
 	}
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 1/1] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
  2011-11-07 16:25 [PATCH 1/1] mmc: omap_hsmmc: DMA unmap only once in case of MMC error Balaji T K
@ 2011-11-07 18:29 ` Russell King - ARM Linux
  2011-11-07 18:41   ` Chris Ball
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2011-11-07 18:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 07, 2011 at 09:55:11PM +0530, Balaji T K wrote:
> From: Per Forlin <per.forlin@linaro.org>
> 
> Reported by Russell King:
> mmcblk0: error -84 transferring data, sector 149201, nr 64,
> cmd response 0x900, card status 0xb00
> mmcblk0: retrying using single block read
> 
> WARNING: at lib/dma-debug.c:811 check_unmap
> omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
> it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
> 
> In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
> and then again in omap_hsmmc_post_req(). Resolve this by clearing the
> host_cookie to indicate there is no DMA mapped memory to unmap.
> 
> Signed-off-by: Per Forlin <per.forlin@linaro.org>
> Tested-by: Balaji T K <balajitk@ti.com>
> ---
> Repost with my Tested-by

Thanks.

Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>

> 
>  drivers/mmc/host/omap_hsmmc.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 101cd31..d5fe43d 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1010,6 +1010,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
>  			host->data->sg_len,
>  			omap_hsmmc_get_dma_dir(host, host->data));
>  		omap_free_dma(dma_ch);
> +		host->data->host_cookie = 0;
>  	}
>  	host->data = NULL;
>  }
> @@ -1575,8 +1576,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
>  	struct mmc_data *data = mrq->data;
>  
>  	if (host->use_dma) {
> -		dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
> -			     omap_hsmmc_get_dma_dir(host, data));
> +		if (data->host_cookie)
> +			dma_unmap_sg(mmc_dev(host->mmc), data->sg,
> +				     data->sg_len,
> +				     omap_hsmmc_get_dma_dir(host, data));
>  		data->host_cookie = 0;
>  	}
>  }
> -- 
> 1.7.0.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
  2011-11-07 18:29 ` Russell King - ARM Linux
@ 2011-11-07 18:41   ` Chris Ball
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Ball @ 2011-11-07 18:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Mon, Nov 07 2011, Russell King - ARM Linux wrote:
> On Mon, Nov 07, 2011 at 09:55:11PM +0530, Balaji T K wrote:
>> From: Per Forlin <per.forlin@linaro.org>
>> 
>> Reported by Russell King:
>> mmcblk0: error -84 transferring data, sector 149201, nr 64,
>> cmd response 0x900, card status 0xb00
>> mmcblk0: retrying using single block read
>> 
>> WARNING: at lib/dma-debug.c:811 check_unmap
>> omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
>> it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
>> 
>> In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
>> and then again in omap_hsmmc_post_req(). Resolve this by clearing the
>> host_cookie to indicate there is no DMA mapped memory to unmap.
>> 
>> Signed-off-by: Per Forlin <per.forlin@linaro.org>
>> Tested-by: Balaji T K <balajitk@ti.com>
>> ---
>> Repost with my Tested-by
>
> Thanks.
>
> Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>

Thanks, pushed to mmc-next for 3.2.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-07 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07 16:25 [PATCH 1/1] mmc: omap_hsmmc: DMA unmap only once in case of MMC error Balaji T K
2011-11-07 18:29 ` Russell King - ARM Linux
2011-11-07 18:41   ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).