U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Philip Oberfichtner <pro@denx.de>
To: u-boot@lists.denx.de
Cc: Philip Oberfichtner <pro@denx.de>,
	Daniel Schwierzeck <daniel.schwierzeck@gmail.com>,
	GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
	Stefan Roese <sr@denx.de>, Tom Rini <trini@konsulko.com>,
	Weijie Gao <weijie.gao@mediatek.com>
Subject: [PATCH v5 3/4] mips: serial: Silence "unused variable" warning
Date: Wed, 30 Jul 2025 14:38:32 +0200	[thread overview]
Message-ID: <20250730123833.249923-4-pro@denx.de> (raw)
In-Reply-To: <20250730123833.249923-1-pro@denx.de>

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@denx.de>
---

Notes:
    Changes in v5: none
    
    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


  parent reply	other threads:[~2025-07-30 12:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 12:38 [PATCH v5 0/4] Add Onion Omega2/2+ board support Philip Oberfichtner
2025-07-30 12:38 ` [PATCH v5 1/4] Makefile: Simplify size check Philip Oberfichtner
2025-07-31 16:05   ` Tom Rini
2025-07-30 12:38 ` [PATCH v5 2/4] Makefile: Add size check for u-boot-with-spl.bin Philip Oberfichtner
2025-07-31 16:05   ` Tom Rini
2025-07-30 12:38 ` Philip Oberfichtner [this message]
2025-07-30 12:38 ` [PATCH v5 4/4] mips: mt7628: Add Onion Omega2/2+ board support Philip Oberfichtner
2025-08-04 15:02   ` Daniel Schwierzeck
2025-08-07  7:59     ` Philip Oberfichtner
2025-08-04 10:00 ` [PATCH v5 0/4] " Philip Oberfichtner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250730123833.249923-4-pro@denx.de \
    --to=pro@denx.de \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=daniel.schwierzeck@gmail.com \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox