Skip to contentSkip to conversation

of: correct of_console_check()'s return value

PATCH In review Brian Norris 2 participants 5 messages Sep 3, 2014 – Sep 28, 2014 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of: correct of_console_check()'s return value

The comments above of_console_check() say that it will return TRUE if it registers a preferred console, but add_preferred_console() uses a 0-equals-success convention, so ths leaves of_console_check() with an inconsistent policy for its return values.

Fortunately, nobody was actually checking the return value of of_console_check(), so this isn't significant at the moment.

But let's match the comments, so we're doing what we say.

Fixes 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
Cc Grant Likely <[email protected]>

---
This is one way to fix it. Another possibility includes changing of_console_check() to use 0-as-success

 drivers/of/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
index d8574adf0d62..bcfd08c2795c 100644
@@ -1986,7 +1986,7 @@ bool of_console_check(struct device_node *dn, char *name, int index)
 {
 	if (!dn || dn != of_stdout || console_set_on_cmdline)
 		return false;
-	return add_preferred_console(name, index, NULL);
+	return !add_preferred_console(name, index, NULL);
 }
 EXPORT_SYMBOL_GPL(of_console_check);
 
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 5 lines · Brian Norris

The comments above of_console_check() say that it will return TRUE if it registers a preferred console, but add_preferred_console() uses a 0-equals-success convention, so ths leaves of_console_check() with an inconsistent policy for its return values.

Quoted 8 lines

Fortunately, nobody was actually checking the return value of of_console_check(), so this isn't significant at the moment.

But let's match the comments, so we're doing what we say.

Fixes 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
Cc Grant Likely <[email protected]>

Good catch. Applied, thanks.

g.

Quoted 23 lines

---
This is one way to fix it. Another possibility includes changing of_console_check() to use 0-as-success

 drivers/of/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
index d8574adf0d62..bcfd08c2795c 100644
@@ -1986,7 +1986,7 @@ bool of_console_check(struct device_node *dn, char *name, int index)
 {
 	if (!dn || dn != of_stdout || console_set_on_cmdline)
 		return false;
-	return add_preferred_console(name, index, NULL);
+	return !add_preferred_console(name, index, NULL);
 }
 EXPORT_SYMBOL_GPL(of_console_check);
 
Signature · 1 line
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author Applied
#2 lore raw

Hi Grant,

Quoted 9 lines · Grant Likely
Quoted 8 lines · Brian Norris

The comments above of_console_check() say that it will return TRUE if it registers a preferred console, but add_preferred_console() uses a 0-equals-success convention, so ths leaves of_console_check() with an inconsistent policy for its return values.

Fortunately, nobody was actually checking the return value of of_console_check(), so this isn't significant at the moment.

Quoted 7 lines
Quoted 5 lines

But let's match the comments, so we're doing what we say.

Fixes 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
Cc Grant Likely <[email protected]>

Good catch. Applied, thanks.

Applied to what? I don't see it in linux-next.

Regards,
Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

It got merged into mainline on Thursday.

g.

Quoted 28 lines · Brian Norris

Hi Grant,

Quoted 1 line · Grant Likely

On Wed, 3 Sep 2014 11:06:43 -0700, Brian Norris <

Quoted 1 line · [email protected]> wrote:
Quoted 1 line

The comments above of_console_check() say that it will return TRUE if

it

Quoted 10 lines
Quoted 10 lines

registers a preferred console, but add_preferred_console() uses a 0-equals-success convention, so ths leaves of_console_check() with an inconsistent policy for its return values.

Fortunately, nobody was actually checking the return value of of_console_check(), so this isn't significant at the moment.

But let's match the comments, so we're doing what we say.

Fixes 3482f2c52b77 ('of: Create of_console_check() for selecting a

console specified in /chosen')

Quoted 4 lines
Quoted 2 lines

Good catch. Applied, thanks.

Applied to what? I don't see it in linux-next.

Regards,
Brian

#4 lore raw
In reply to Brian Norris
Quoted 14 lines · Brian Norris

Hi Grant,

Quoted 11 lines · Grant Likely
Quoted 10 lines · Brian Norris

The comments above of_console_check() say that it will return TRUE if it registers a preferred console, but add_preferred_console() uses a 0-equals-success convention, so ths leaves of_console_check() with an inconsistent policy for its return values.

Fortunately, nobody was actually checking the return value of of_console_check(), so this isn't significant at the moment.

But let's match the comments, so we're doing what we say.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Fixes 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
Cc Grant Likely <[email protected]>

Good catch. Applied, thanks.

Applied to what? I don't see it in linux-next.

It got merged into mainline on Thursday.

g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html