Skip to contentSkip to conversation

tty: serial: msm_serial: Remove __init from msm_console_setup()

PATCH In review Jeffrey Hugo 2 participants 2 messages Feb 17, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: serial: msm_serial: Remove __init from msm_console_setup()

Due to the complexities of modern Qualcomm SoCs, about a half dozen drivers must successfully probe before the clocks for the console are present, and the console can successfully probe. Depending on several random factors such as probe order and modules vs builtin, msm_serial may not be able to successfully probe for some, at which point, __init annotated functions may become unmapped. If this occurs, msm_console_setup() will be called from the probe path, but will no longer exist, resulting in a kernel panic.

Resolve this issue by removing the __init annotation from msm_console_setup().

---
 drivers/tty/serial/msm_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/msm_serial.c +1 -1
index 736b74f..1090960 100644
@@ -1634,7 +1634,7 @@ static void msm_console_write(struct console *co, const char *s,
 	__msm_console_write(port, s, count, msm_port->is_uartdm);
 }
 
-static int __init msm_console_setup(struct console *co, char *options)
+static int msm_console_setup(struct console *co, char *options)
 {
 	struct uart_port *port;
 	int baud = 115200;
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jeffrey Hugo

Due to the complexities of modern Qualcomm SoCs, about a half dozen drivers must successfully probe before the clocks for the console are present, and the console can successfully probe. Depending on several random factors such as probe order and modules vs builtin, msm_serial may not be able to successfully probe for some, at which point, __init annotated functions may become unmapped. If this occurs, msm_console_setup() will be called from the probe path, but will no longer exist, resulting in a kernel panic.

Resolve this issue by removing the __init annotation from msm_console_setup().

I'm pretty sure I've stumbled upon this several times without knowing what hit me.

Regards,
Bjorn

Quoted 24 lines
---
 drivers/tty/serial/msm_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/msm_serial.c +1 -1
index 736b74f..1090960 100644
@@ -1634,7 +1634,7 @@ static void msm_console_write(struct console *co, const char *s,
 	__msm_console_write(port, s, count, msm_port->is_uartdm);
 }
 
-static int __init msm_console_setup(struct console *co, char *options)
+static int msm_console_setup(struct console *co, char *options)
 {
 	struct uart_port *port;
 	int baud = 115200;
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.