From nobody Thu Apr 2 11:43:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A30F3C6FA82 for ; Mon, 26 Sep 2022 03:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233343AbiIZDCQ (ORCPT ); Sun, 25 Sep 2022 23:02:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233248AbiIZDCF (ORCPT ); Sun, 25 Sep 2022 23:02:05 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 857CA2C117; Sun, 25 Sep 2022 20:02:03 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MbS8q6skqzHtnq; Mon, 26 Sep 2022 10:57:15 +0800 (CST) Received: from dggpeml500008.china.huawei.com (7.185.36.147) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 11:02:01 +0800 Received: from huawei.com (10.67.175.34) by dggpeml500008.china.huawei.com (7.185.36.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 11:02:01 +0800 From: Ren Zhijie To: , , , , CC: , , , , "Ren Zhijie" Subject: [PATCH -next] serial: stm32: Fix unused-variable warning Date: Mon, 26 Sep 2022 02:58:26 +0000 Message-ID: <20220926025826.44145-1-renzhijie2@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.175.34] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500008.china.huawei.com (7.185.36.147) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: =E2=80=98stm32h7_info=E2=80= =99 defined but not used [-Werror=3Dunused-variable] static struct stm32_usart_info stm32h7_info =3D { ^~~~~~~~~~~~ drivers/tty/serial/stm32-usart.c:61:32: error: =E2=80=98stm32f7_info=E2=80= =99 defined but not used [-Werror=3Dunused-variable] static struct stm32_usart_info stm32f7_info =3D { ^~~~~~~~~~~~ drivers/tty/serial/stm32-usart.c:40:32: error: =E2=80=98stm32f4_info=E2=80= =99 defined but not used [-Werror=3Dunused-variable] static struct stm32_usart_info stm32f4_info =3D { ^~~~~~~~~~~~ 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 spar= se warnings") Signed-off-by: Ren Zhijie --- 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-us= art.c index 0b18615b2ca4..22013b12f471 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -37,7 +37,7 @@ =20 =20 /* Register offsets */ -static struct stm32_usart_info stm32f4_info =3D { +static struct stm32_usart_info __maybe_unused stm32f4_info =3D { .ofs =3D { .isr =3D 0x00, .rdr =3D 0x04, @@ -58,7 +58,7 @@ static struct stm32_usart_info stm32f4_info =3D { } }; =20 -static struct stm32_usart_info stm32f7_info =3D { +static struct stm32_usart_info __maybe_unused stm32f7_info =3D { .ofs =3D { .cr1 =3D 0x00, .cr2 =3D 0x04, @@ -80,7 +80,7 @@ static struct stm32_usart_info stm32f7_info =3D { } }; =20 -static struct stm32_usart_info stm32h7_info =3D { +static struct stm32_usart_info __maybe_unused stm32h7_info =3D { .ofs =3D { .cr1 =3D 0x00, .cr2 =3D 0x04, --=20 2.17.1