mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] s3cmci: Fix hangup in do_pio_write()
@ 2009-01-01 11:09 Yauhen Kharuzhy
  2009-01-12 14:43 ` Pierre Ossman
  0 siblings, 1 reply; 2+ messages in thread
From: Yauhen Kharuzhy @ 2009-01-01 11:09 UTC (permalink / raw)
  To: Ben Dooks; +Cc: Pierre Ossman, linux-kernel, Yauhen Kharuzhy

This commit fixes the regression what was added by commit
088a78af978d0c8e339071a9b2bca1f4cb368f30 "s3cmci: Support transfers
which are not multiple of 32 bits."

fifo_free() now returns amount of available space in FIFO buffer in
bytes. But do_pio_write() writes to FIFO 32-bit words. Condition for
return from cycle is (fifo_free() == 0), but when fifo has 1..3 bytes of
free space then this condition will never be true and system hangs.

This patch changes condition in the while() to (fifo_free() > 3).

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
 drivers/mmc/host/s3cmci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index fd6b5b8..9778deb 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -329,7 +329,7 @@ static void do_pio_write(struct s3cmci_host *host)
 
 	to_ptr = host->base + host->sdidata;
 
-	while ((fifo = fifo_free(host))) {
+	while ((fifo = fifo_free(host)) > 3) {
 		if (!host->pio_bytes) {
 			res = get_data_buffer(host, &host->pio_bytes,
 							&host->pio_ptr);
-- 
1.5.6.5


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

* Re: [PATCH] s3cmci: Fix hangup in do_pio_write()
  2009-01-01 11:09 [PATCH] s3cmci: Fix hangup in do_pio_write() Yauhen Kharuzhy
@ 2009-01-12 14:43 ` Pierre Ossman
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre Ossman @ 2009-01-12 14:43 UTC (permalink / raw)
  To: Ben Dooks; +Cc: Yauhen Kharuzhy, linux-kernel, Yauhen Kharuzhy

On Thu,  1 Jan 2009 13:09:04 +0200
Yauhen Kharuzhy <jekhor@gmail.com> wrote:

> This commit fixes the regression what was added by commit
> 088a78af978d0c8e339071a9b2bca1f4cb368f30 "s3cmci: Support transfers
> which are not multiple of 32 bits."
> 
> fifo_free() now returns amount of available space in FIFO buffer in
> bytes. But do_pio_write() writes to FIFO 32-bit words. Condition for
> return from cycle is (fifo_free() == 0), but when fifo has 1..3 bytes of
> free space then this condition will never be true and system hangs.
> 
> This patch changes condition in the while() to (fifo_free() > 3).
> 
> Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>

Any objections here Ben? An Acked-by would be nice.

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  rdesktop, core developer          http://www.rdesktop.org

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

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

end of thread, other threads:[~2009-01-12 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-01 11:09 [PATCH] s3cmci: Fix hangup in do_pio_write() Yauhen Kharuzhy
2009-01-12 14:43 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®