[PATCH v4 2/3] mips: serial: Silence "unused variable" warning
Philip Oberfichtner
pro at denx.de
Tue Jul 8 12:39:58 CEST 2025
Before this commit, mtmips_spl_serial_init() caused the following
warning:
arch/mips/mach-mtmips/mt7628/serial.c:14:23: warning: unused variable ‘base’ [-Wunused-variable]
14 | void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
| ^~~~
This happens whenever CONFIG_SPECIFY_CONSOLE_INDEX is unset, which leads
to an effectively empty function:
void mtmips_spl_serial_init(void)
{
void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
}
Add the __maybe_unused attribute to silence this warning.
Signed-off-by: Philip Oberfichtner <pro at denx.de>
---
Notes:
Changes in v4: new
arch/mips/mach-mtmips/mt7620/serial.c | 2 +-
arch/mips/mach-mtmips/mt7621/spl/serial.c | 2 +-
arch/mips/mach-mtmips/mt7628/serial.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/mach-mtmips/mt7620/serial.c b/arch/mips/mach-mtmips/mt7620/serial.c
index 35544b8537e..a6915865e27 100644
--- a/arch/mips/mach-mtmips/mt7620/serial.c
+++ b/arch/mips/mach-mtmips/mt7620/serial.c
@@ -24,7 +24,7 @@ void board_debug_uart_init(void)
void mtmips_spl_serial_init(void)
{
#ifdef CONFIG_SPL_SERIAL
- void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
+ void __iomem __maybe_unused *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
#if CONFIG_CONS_INDEX == 1
clrbits_32(base + SYSCTL_GPIOMODE_REG, UARTL_GPIO_MODE);
diff --git a/arch/mips/mach-mtmips/mt7621/spl/serial.c b/arch/mips/mach-mtmips/mt7621/spl/serial.c
index 5cf093a078a..3f600d778e7 100644
--- a/arch/mips/mach-mtmips/mt7621/spl/serial.c
+++ b/arch/mips/mach-mtmips/mt7621/spl/serial.c
@@ -11,7 +11,7 @@
void mtmips_spl_serial_init(void)
{
#ifdef CONFIG_SPL_SERIAL
- void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
+ void __iomem __maybe_unused *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
#if CONFIG_CONS_INDEX == 1
clrbits_32(base + SYSCTL_GPIOMODE_REG, UART1_MODE);
diff --git a/arch/mips/mach-mtmips/mt7628/serial.c b/arch/mips/mach-mtmips/mt7628/serial.c
index 11a2149e127..88d63f3825b 100644
--- a/arch/mips/mach-mtmips/mt7628/serial.c
+++ b/arch/mips/mach-mtmips/mt7628/serial.c
@@ -11,7 +11,7 @@
void mtmips_spl_serial_init(void)
{
#ifdef CONFIG_SPL_SERIAL
- void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
+ void __iomem __maybe_unused *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
#if CONFIG_CONS_INDEX == 1
clrbits_32(base + SYSCTL_GPIO_MODE1_REG, UART0_MODE_M);
--
2.39.5
More information about the U-Boot
mailing list