From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by gnuweeb.org (Postfix) with ESMTPS id 86D8B7E24D for ; Fri, 30 Dec 2022 18:18:04 +0000 (UTC) Received: by mail-io1-f51.google.com with SMTP id d123so11480524iof.6 for ; Fri, 30 Dec 2022 10:18:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CA5uU9xfc2kQPK+mg/5jhRujnxjVswB27Z1UxXXBvOg=; b=XsN5cWnreAhNIcyfEuxXHUnnsS7v4byFj8BMvI64kQHWZmZJNwbe/TBkQuuH3Wli1c Ag7dto5oG2suuw/6lWh5Uq+VAjuk/lRh/C7V0MssGSZ9mKnT8FcE80LDHXIpH2M4WEJa hcVdLYjQh0Ntf57tx3tnuxlN/BU9+qZ229QgjV8FRAt+8PvNJdDWS/k5U16oPdGgT1ZZ GliQlhcPG7qvbejSxXoEQbOXXN1wP8I57HiFtw8O/jAVpP7ZMA0Z6pY0+NLR7Kw59i5L JP49j8bHykkp5why/53yxeZL3xwi4GALW2a2Rgrd2lj2oa9aYLy21xSjyjTffp9IDb/e c1QQ== X-Gm-Message-State: AFqh2kov43X81T87c8hoPLgvxbSTXomC1Zz92Ps9w57NCKjz3PV26VA9 jLs/5zBidf3ItfMtRqXnzIWLRELCWfU78t2f8d0= X-Google-Smtp-Source: AMrXdXtvG/+juumm/OZ/6Xk91ooHhF3lK0NDpHretXH3t7gCzczen11e1APu8EEbwu9uQ62YiVCVqPHZpEtSMwIgIyo= X-Received: by 2002:a02:3b4f:0:b0:39a:98b:480e with SMTP id i15-20020a023b4f000000b0039a098b480emr2485950jaf.125.1672424283499; Fri, 30 Dec 2022 10:18:03 -0800 (PST) MIME-Version: 1.0 References: <20221223142419.3781410-1-ammar.faizi@intel.com> <20221223142419.3781410-3-ammar.faizi@intel.com> In-Reply-To: <20221223142419.3781410-3-ammar.faizi@intel.com> From: "Rafael J. Wysocki" Date: Fri, 30 Dec 2022 19:17:51 +0100 Message-ID: Subject: Re: [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning To: Ammar Faizi Cc: Robert Moore , "Rafael J. Wysocki" , Len Brown , Nick Desaulniers , Tom Rix , Nathan Chancellor , Linux ACPI Mailing List , Linux Kernel Mailing List , ACPICA Mailing List , LLVM Mailing List , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" List-Id: On Fri, Dec 23, 2022 at 3:24 PM Ammar Faizi wrote: > > From: Ammar Faizi > > @num_carats is used for debugging, passed to the 'ACPI_DEBUG_PRINT()' > macro. But this macro will expand to nothing when debug is disabled, > resulting in the following (clang-16): > > drivers/acpi/acpica/nsaccess.c:295:6: error: variable 'num_carats' set \ > but not used [-Werror,-Wunused-but-set-variable] > u32 num_carats; > ^ > 1 error generated. > > Move the variable declaration inside the else block to reduce the scope, > then add '(void)num_carats' to silence the warning when debug is disabled. > > Cc: LLVM Mailing List > Signed-off-by: Ammar Faizi ACPICA changes require (at least) a pull request to be submitted to the upstream ACPICA project on GitHub. If such a pull request is created, please resend the Linux patch with a Link tag pointing to that pull request. Thanks! > --- > drivers/acpi/acpica/nsaccess.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c > index a0c1a665dfc1..d73d052c5b3b 100644 > --- a/drivers/acpi/acpica/nsaccess.c > +++ b/drivers/acpi/acpica/nsaccess.c > @@ -292,7 +292,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, > struct acpi_namespace_node *current_node = NULL; > struct acpi_namespace_node *this_node = NULL; > u32 num_segments; > - u32 num_carats; > acpi_name simple_name; > acpi_object_type type_to_check_for; > acpi_object_type this_search_type; > @@ -394,6 +393,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, > "Path is absolute from root [%p]\n", > this_node)); > } else { > + u32 num_carats = 0; > /* Pathname is relative to current scope, start there */ > > ACPI_DEBUG_PRINT((ACPI_DB_NAMES, > @@ -406,7 +406,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, > * the parent node for each prefix instance. > */ > this_node = prefix_node; > - num_carats = 0; > while (*path == (u8) AML_PARENT_PREFIX) { > > /* Name is fully qualified, no search rules apply */ > @@ -449,6 +448,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, > "Search scope is [%4.4s], path has %u carat(s)\n", > acpi_ut_get_node_name > (this_node), num_carats)); > + (void)num_carats; > } > } > > -- > Ammar Faizi >