All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m68k: amiflop: *ptr incremented past 0x4489
@ 2009-02-11 14:42 Roel Kluin
  2009-02-13  8:07 ` Joerg Dorchain
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-11 14:42 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, Andrew Morton

With while (*ptr++ != 0x4489) { ... } *ptr will be incremented past 0x4489 after
the loop.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 8df436f..3320b00 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -662,8 +662,8 @@ static unsigned long scan_sync(unsigned long raw, unsigned long end)
 {
 	ushort *ptr = (ushort *)raw, *endp = (ushort *)end;
 
-	while (ptr < endp && *ptr++ != 0x4489)
-		;
+	while (ptr < endp && *ptr != 0x4489)
+		++ptr;
 	if (ptr < endp) {
 		while (*ptr == 0x4489 && ptr < endp)
 			ptr++;

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

* Re: [PATCH] m68k: amiflop: *ptr incremented past 0x4489
  2009-02-11 14:42 [PATCH] m68k: amiflop: *ptr incremented past 0x4489 Roel Kluin
@ 2009-02-13  8:07 ` Joerg Dorchain
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Dorchain @ 2009-02-13  8:07 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linux-m68k, Geert Uytterhoeven, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Wed, Feb 11, 2009 at 03:42:54PM +0100, Roel Kluin wrote:
> With while (*ptr++ != 0x4489) { ... } *ptr will be incremented past 0x4489
> after
> the loop.

Yes, that is on purpose. The magic bytes of 0x4489 are a sync
mark, the interesting stuff always starts afterwards. The whole
decoding routing uses the current pointer the way that it always
points to the next unprocessed position when it arrives at the
next segment of decoding. I'd rather have this consistent in the
whole driver.

Bye,

Joerg

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2009-02-13  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11 14:42 [PATCH] m68k: amiflop: *ptr incremented past 0x4489 Roel Kluin
2009-02-13  8:07 ` Joerg Dorchain

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.