All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sparclinux@vger.kernel.org
Subject: Re: [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error
Date: Sun, 29 Jul 2007 08:00:00 +0000	[thread overview]
Message-ID: <20070729.010000.74747667.davem@davemloft.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0707290259060.28781@mtfhpc.demon.co.uk>

From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
Date: Sun, 29 Jul 2007 08:55:25 +0100 (BST)

> Yes but then you do a !skip-- so 0 -> -1 and 1 -> 0

Indeed.  This is coded in a very non-intuitive manner.  The code
selecting the string wants to use the original value of "skip", not
the one modified by the node traversal loop.

Perhaps the following version of the fix is a little clearer.
What do you think?

diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index e3a5376..39fbd3c 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -415,7 +415,7 @@ static void __init of_console_init(void)
 	unsigned long flags;
 	const char *type;
 	phandle node;
-	int skip, fd;
+	int skip, tmp, fd;
 
 	of_console_path = prom_early_alloc(256);
 
@@ -442,8 +442,9 @@ static void __init of_console_init(void)
 			prom_halt();
 		}
 
+		tmp = skip;
 		for_each_node_by_type(dp, type) {
-			if (!skip--)
+			if (!tmp--)
 				break;
 		}
 		if (!dp) {

  parent reply	other threads:[~2007-07-29  8:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-29  2:17 [PATCH] v2.6.23-rc1 Sparc32 Serial Port Selection error Mark Fortescue
2007-07-29  5:53 ` David Miller
2007-07-29  6:43 ` David Miller
2007-07-29  7:55 ` Mark Fortescue
2007-07-29  8:00 ` David Miller [this message]
2007-07-29  8:42 ` Mark Fortescue
2007-07-29  9:09 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070729.010000.74747667.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.