[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220926025826.44145-1-renzhijie2@huawei.com>
Date: Mon, 26 Sep 2022 02:58:26 +0000
From: Ren Zhijie <renzhijie2@...wei.com>
To: <gregkh@...uxfoundation.org>, <jirislaby@...nel.org>,
<mcoquelin.stm32@...il.com>, <alexandre.torgue@...s.st.com>,
<ben-linux@...ff.org>
CC: <linux-serial@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
"Ren Zhijie" <renzhijie2@...wei.com>
Subject: [PATCH -next] serial: stm32: Fix unused-variable warning
If CONFIG_SERIAL_EARLYCON and CONFIG_OF are both not set,
gcc warns about unused variable:
drivers/tty/serial/stm32-usart.c:83:32: error: ‘stm32h7_info’ defined but not used [-Werror=unused-variable]
static struct stm32_usart_info stm32h7_info = {
^~~~~~~~~~~~
drivers/tty/serial/stm32-usart.c:61:32: error: ‘stm32f7_info’ defined but not used [-Werror=unused-variable]
static struct stm32_usart_info stm32f7_info = {
^~~~~~~~~~~~
drivers/tty/serial/stm32-usart.c:40:32: error: ‘stm32f4_info’ defined but not used [-Werror=unused-variable]
static struct stm32_usart_info stm32f4_info = {
^~~~~~~~~~~~
cc1: all warnings being treated as errors
Mark these variables as __maybe_unused to fix this.
Fixes: c7039ce904c0 ("serial: stm32: make info structs static to avoid sparse warnings")
Signed-off-by: Ren Zhijie <renzhijie2@...wei.com>
---
drivers/tty/serial/stm32-usart.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 0b18615b2ca4..22013b12f471 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -37,7 +37,7 @@
/* Register offsets */
-static struct stm32_usart_info stm32f4_info = {
+static struct stm32_usart_info __maybe_unused stm32f4_info = {
.ofs = {
.isr = 0x00,
.rdr = 0x04,
@@ -58,7 +58,7 @@ static struct stm32_usart_info stm32f4_info = {
}
};
-static struct stm32_usart_info stm32f7_info = {
+static struct stm32_usart_info __maybe_unused stm32f7_info = {
.ofs = {
.cr1 = 0x00,
.cr2 = 0x04,
@@ -80,7 +80,7 @@ static struct stm32_usart_info stm32f7_info = {
}
};
-static struct stm32_usart_info stm32h7_info = {
+static struct stm32_usart_info __maybe_unused stm32h7_info = {
.ofs = {
.cr1 = 0x00,
.cr2 = 0x04,
--
2.17.1
Powered by blists - more mailing lists