All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq.
@ 2011-05-05 11:14 ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2011-05-05 11:14 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel; +Cc: Lee Jones, Dmitry Tarnyagin, Linus Walleij

From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>

Earlier code was expecting that mmci_pio_write() returns
not more than 'remain' bytes transferred. It is not the case
for buffers which are not multiple of 4 bytes length.

The patch fix the problem by checking result of mmci_pio_write().

The fault was introduced in the change:
	I2e506ec1f5a7fadf9780c18d8d31573eaf048273
	MMCI: Fixup sg buffer handling in pio_write

Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mmc/host/mmci.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 6e27433..e238462 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -753,7 +753,10 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id)
 		if (status & MCI_TXACTIVE)
 			len = mmci_pio_write(host, buffer, remain, status);
 
-		sg_miter->consumed = len;
+		if (len > sg_miter->consumed)
+			len = sg_miter->consumed;
+		else
+			sg_miter->consumed = len;
 
 		host->size -= len;
 		remain -= len;
-- 
1.7.3.2


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

* [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq.
@ 2011-05-05 11:14 ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2011-05-05 11:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>

Earlier code was expecting that mmci_pio_write() returns
not more than 'remain' bytes transferred. It is not the case
for buffers which are not multiple of 4 bytes length.

The patch fix the problem by checking result of mmci_pio_write().

The fault was introduced in the change:
	I2e506ec1f5a7fadf9780c18d8d31573eaf048273
	MMCI: Fixup sg buffer handling in pio_write

Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mmc/host/mmci.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 6e27433..e238462 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -753,7 +753,10 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id)
 		if (status & MCI_TXACTIVE)
 			len = mmci_pio_write(host, buffer, remain, status);
 
-		sg_miter->consumed = len;
+		if (len > sg_miter->consumed)
+			len = sg_miter->consumed;
+		else
+			sg_miter->consumed = len;
 
 		host->size -= len;
 		remain -= len;
-- 
1.7.3.2

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

* Re: [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq.
  2011-05-05 11:14 ` Linus Walleij
@ 2011-05-08 10:22   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2011-05-08 10:22 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-mmc, linux-arm-kernel, Linus Walleij, Lee Jones, Dmitry Tarnyagin

On Thu, May 05, 2011 at 01:14:23PM +0200, Linus Walleij wrote:
> From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> 
> Earlier code was expecting that mmci_pio_write() returns
> not more than 'remain' bytes transferred. It is not the case
> for buffers which are not multiple of 4 bytes length.
> 
> The patch fix the problem by checking result of mmci_pio_write().
> 
> The fault was introduced in the change:
> 	I2e506ec1f5a7fadf9780c18d8d31573eaf048273
> 	MMCI: Fixup sg buffer handling in pio_write

I assume this isn't for mainline as that commit isn't present.

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

* [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq.
@ 2011-05-08 10:22   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2011-05-08 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 05, 2011 at 01:14:23PM +0200, Linus Walleij wrote:
> From: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
> 
> Earlier code was expecting that mmci_pio_write() returns
> not more than 'remain' bytes transferred. It is not the case
> for buffers which are not multiple of 4 bytes length.
> 
> The patch fix the problem by checking result of mmci_pio_write().
> 
> The fault was introduced in the change:
> 	I2e506ec1f5a7fadf9780c18d8d31573eaf048273
> 	MMCI: Fixup sg buffer handling in pio_write

I assume this isn't for mainline as that commit isn't present.

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

* Re: [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq.
  2011-05-08 10:22   ` Russell King - ARM Linux
@ 2011-05-08 20:13     ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2011-05-08 20:13 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Linus Walleij, linux-mmc, linux-arm-kernel, Lee Jones, Dmitry Tarnyagin

On Sun, May 8, 2011 at 12:22 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Thu, May 05, 2011 at 01:14:23PM +0200, Linus Walleij wrote:
>> The patch fix the problem by checking result of mmci_pio_write().
>>
>> The fault was introduced in the change:
>>       I2e506ec1f5a7fadf9780c18d8d31573eaf048273
>>       MMCI: Fixup sg buffer handling in pio_write
>
> I assume this isn't for mainline as that commit isn't present.

No I screwed up, I will post a combined patch with both and an
explanation instead, only relates to SDIO FWIW.

Thanks for your patience.

Yours,
Linus Walleij

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

* [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq.
@ 2011-05-08 20:13     ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2011-05-08 20:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, May 8, 2011 at 12:22 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Thu, May 05, 2011 at 01:14:23PM +0200, Linus Walleij wrote:
>> The patch fix the problem by checking result of mmci_pio_write().
>>
>> The fault was introduced in the change:
>> ? ? ? I2e506ec1f5a7fadf9780c18d8d31573eaf048273
>> ? ? ? MMCI: Fixup sg buffer handling in pio_write
>
> I assume this isn't for mainline as that commit isn't present.

No I screwed up, I will post a combined patch with both and an
explanation instead, only relates to SDIO FWIW.

Thanks for your patience.

Yours,
Linus Walleij

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

end of thread, other threads:[~2011-05-08 20:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-05 11:14 [PATCH 2/2] mmci: fixup sg buffer handling in mmci_pio_irq Linus Walleij
2011-05-05 11:14 ` Linus Walleij
2011-05-08 10:22 ` Russell King - ARM Linux
2011-05-08 10:22   ` Russell King - ARM Linux
2011-05-08 20:13   ` Linus Walleij
2011-05-08 20:13     ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.