Skip to contentSkip to conversation

8250_core.c : Global variable shouldn't be initialized to NULL

PATCH In review Omer Faruk BULUT 2 participants 2 messages Oct 14, 2024 – Oct 15, 2024 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 8250_core.c : Global variable shouldn't be initialized to NULL

I check it with checkpatch. Then remove the NULL part.

Signed-by-off: Omer Faruk BULUT <[email protected]>

---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
index 5f9f06911795..435396233863 100644
@@ -304,7 +304,7 @@ static void univ8250_release_irq(struct uart_8250_port *up)
 		serial_unlink_irq_chain(up);
 }
 
-const struct uart_ops *univ8250_port_base_ops = NULL;
+const struct uart_ops *univ8250_port_base_ops;
 struct uart_ops univ8250_port_ops;
 
 static const struct uart_8250_ops univ8250_driver_ops = {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Omer Faruk BULUT

I check it with checkpatch. Then remove the NULL part.

checkpatch may be false positive. Please, add a better analysis that it's fine to do a such cleanup. Note, this variable is _not_ static.

...

drivers/tty/serial/8250/8250_core.c static void univ8250_release_irq(struct uart_8250_port *up) · line 307

Quoted 2 lines
drivers/tty/serial/8250/8250_core.c +1 -1
-const struct uart_ops *univ8250_port_base_ops = NULL;
+const struct uart_ops *univ8250_port_base_ops;

Is it guaranteed to be NULL for non-static variables? If so, we want to know the details.

Quoted 1 line

struct uart_ops univ8250_port_ops;

Signature · 2 lines
With Best Regards,
Andy Shevchenko