[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXEbGWs74M2CZSm6TWpD11mReFsk8z-UUqJt6b6vDCvAEQ@mail.gmail.com>
Date: Thu, 10 Feb 2022 20:41:51 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Victor Erminpour <victor.erminpour@...cle.com>,
Robin Murphy <robin.murphy@....com>,
Kees Cook <keescook@...omium.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Hanjun Guo <guohanjun@...wei.com>,
Sudeep Holla <sudeep.holla@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
trivial@...nel.org
Subject: Re: [PATCH v2] ACPI/IORT: Fix GCC 12 warning
On Thu, 10 Feb 2022 at 19:48, Victor Erminpour
<victor.erminpour@...cle.com> wrote:
>
> When building with automatic stack variable initialization, GCC 12
> complains about variables defined outside of switch case statements.
> Move the variable into the case that uses it, which silences the warning:
>
> ./drivers/acpi/arm64/iort.c:1670:59: error: statement will never be executed [-Werror=switch-unreachable]
> 1670 | struct acpi_iort_named_component *ncomp;
> | ^~~~~
>
> Signed-off-by: Victor Erminpour <victor.erminpour@...cle.com>
Please cc people that commented on your v1 when you send a v2.
Still NAK, for the same reasons.
> ---
> drivers/acpi/arm64/iort.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 3b23fb775ac4..65395f0decf9 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -1645,7 +1645,7 @@ void __init acpi_iort_init(void)
> */
> phys_addr_t __init acpi_iort_dma_get_max_cpu_address(void)
> {
> - phys_addr_t limit = PHYS_ADDR_MAX;
> + phys_addr_t local_limit, limit = PHYS_ADDR_MAX;
> struct acpi_iort_node *node, *end;
> struct acpi_table_iort *iort;
> acpi_status status;
> @@ -1667,17 +1667,16 @@ phys_addr_t __init acpi_iort_dma_get_max_cpu_address(void)
> break;
>
> switch (node->type) {
> + case ACPI_IORT_NODE_NAMED_COMPONENT: {
> struct acpi_iort_named_component *ncomp;
> - struct acpi_iort_root_complex *rc;
> - phys_addr_t local_limit;
> -
> - case ACPI_IORT_NODE_NAMED_COMPONENT:
> ncomp = (struct acpi_iort_named_component *)node->node_data;
> local_limit = DMA_BIT_MASK(ncomp->memory_address_limit);
> limit = min_not_zero(limit, local_limit);
> break;
>
> - case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
> + }
> + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: {
> + struct acpi_iort_root_complex *rc;
> if (node->revision < 1)
> break;
>
> @@ -1686,6 +1685,7 @@ phys_addr_t __init acpi_iort_dma_get_max_cpu_address(void)
> limit = min_not_zero(limit, local_limit);
> break;
> }
> + }
> node = ACPI_ADD_PTR(struct acpi_iort_node, node, node->length);
> }
> acpi_put_table(&iort->header);
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Powered by blists - more mailing lists