Thread (6 messages) 6 messages, 2 authors, 2025-01-27
STALE539d

[PATCH] serial: pic32: Fix build warning when CONFIG_OF is disabled

From: Yu-Chun Lin <hidden>
Date: 2025-01-26 16:31:22
Also in: lkml
Subsystem: the rest, tty layer and serial drivers · Maintainers: Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

As reported by the kernel test robot, the following warning occurs:
quoted
drivers/tty/serial/pic32_uart.c:904:34: warning: 'pic32_serial_dt_ids' defined but not used [-Wunused-const-variable=]
     904 | static const struct of_device_id pic32_serial_dt_ids[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~

The 'pic32_serial_dt_ids' array is only used when CONFIG_OF is enabled.
Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_OF'
prevents a compiler warning when OF is disabled.

Reported-by: kernel test robot <redacted>
Closes: https://lore.kernel.org/oe-kbuild-all/202501260006.ecUsBidz-lkp@intel.com/ (local)
Signed-off-by: Yu-Chun Lin <redacted>
---
 drivers/tty/serial/pic32_uart.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index 14d50bd7f1bd..a228a55102c6 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -948,11 +948,13 @@ static void pic32_uart_remove(struct platform_device *pdev)
 	pic32_sports[sport->idx] = NULL;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id pic32_serial_dt_ids[] = {
 	{ .compatible = "microchip,pic32mzda-uart" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, pic32_serial_dt_ids);
+#endif
 
 static struct platform_driver pic32_uart_platform_driver = {
 	.probe		= pic32_uart_probe,
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help