Skip to content

Commit f3bb055

Browse files
Rasmus Villemoestrini
Rasmus Villemoes
authored andcommitted
serial-uclass: drop redundant code in serial_check_stdout()
As the updated comment says, this is already handled by fdt_path_offset_namelen() itself. Signed-off-by: Rasmus Villemoes <[email protected]>
1 parent fa3f0cb commit f3bb055

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/serial/serial-uclass.c

+10-14
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,24 @@ static const unsigned long baudrate_table[] = CFG_SYS_BAUDRATE_TABLE;
3131
static int serial_check_stdout(const void *blob, struct udevice **devp)
3232
{
3333
int node = -1;
34-
const char *str, *p, *name;
34+
const char *str, *p;
3535
int namelen;
3636

3737
/* Check for a chosen console */
3838
str = fdtdec_get_chosen_prop(blob, "stdout-path");
3939
if (str) {
4040
p = strchr(str, ':');
4141
namelen = p ? p - str : strlen(str);
42+
/*
43+
* This also deals with things like
44+
*
45+
* stdout-path = "serial0:115200n8";
46+
*
47+
* since fdt_path_offset_namelen() treats a str not
48+
* beginning with '/' as an alias and thus applies
49+
* fdt_get_alias_namelen() to it.
50+
*/
4251
node = fdt_path_offset_namelen(blob, str, namelen);
43-
44-
if (node < 0) {
45-
/*
46-
* Deal with things like
47-
* stdout-path = "serial0:115200n8";
48-
*
49-
* We need to look up the alias and then follow it to
50-
* the correct node.
51-
*/
52-
name = fdt_get_alias_namelen(blob, str, namelen);
53-
if (name)
54-
node = fdt_path_offset(blob, name);
55-
}
5652
}
5753

5854
if (node < 0)

0 commit comments

Comments
 (0)