Skip to content

Commit 6480609

Browse files
zx2c4tsbogend
authored andcommitted
MIPS: pic32: treat port as signed integer
get_port_from_cmdline() returns an int, yet is assigned to a char, which is wrong in its own right, but also, with char becoming unsigned, this poses problems, because -1 is used as an error value. Further complicating things, fw_init_early_console() is only ever called with a -1 argument. Fix this up by removing the unused argument from fw_init_early_console() and treating port as a proper signed integer. Cc: Thomas Bogendoerfer <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 64ac0be commit 6480609

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

arch/mips/include/asm/fw/fw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ extern char *fw_getcmdline(void);
2626
extern void fw_meminit(void);
2727
extern char *fw_getenv(char *name);
2828
extern unsigned long fw_getenvl(char *name);
29-
extern void fw_init_early_console(char port);
29+
extern void fw_init_early_console(void);
3030

3131
#endif /* __ASM_FW_H_ */

arch/mips/pic32/pic32mzda/early_console.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define U_BRG(x) (UART_BASE(x) + 0x40)
2828

2929
static void __iomem *uart_base;
30-
static char console_port = -1;
30+
static int console_port = -1;
3131

3232
static int __init configure_uart_pins(int port)
3333
{
@@ -47,7 +47,7 @@ static int __init configure_uart_pins(int port)
4747
return 0;
4848
}
4949

50-
static void __init configure_uart(char port, int baud)
50+
static void __init configure_uart(int port, int baud)
5151
{
5252
u32 pbclk;
5353

@@ -60,7 +60,7 @@ static void __init configure_uart(char port, int baud)
6060
uart_base + PIC32_SET(U_STA(port)));
6161
}
6262

63-
static void __init setup_early_console(char port, int baud)
63+
static void __init setup_early_console(int port, int baud)
6464
{
6565
if (configure_uart_pins(port))
6666
return;
@@ -130,16 +130,15 @@ static int __init get_baud_from_cmdline(char *arch_cmdline)
130130
return baud;
131131
}
132132

133-
void __init fw_init_early_console(char port)
133+
void __init fw_init_early_console(void)
134134
{
135135
char *arch_cmdline = pic32_getcmdline();
136-
int baud = -1;
136+
int baud, port;
137137

138138
uart_base = ioremap(PIC32_BASE_UART, 0xc00);
139139

140140
baud = get_baud_from_cmdline(arch_cmdline);
141-
if (port == -1)
142-
port = get_port_from_cmdline(arch_cmdline);
141+
port = get_port_from_cmdline(arch_cmdline);
143142

144143
if (port == -1)
145144
port = EARLY_CONSOLE_PORT;

arch/mips/pic32/pic32mzda/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void __init plat_mem_setup(void)
4747
strscpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
4848

4949
#ifdef CONFIG_EARLY_PRINTK
50-
fw_init_early_console(-1);
50+
fw_init_early_console();
5151
#endif
5252
pic32_config_init();
5353
}

0 commit comments

Comments
 (0)