GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
* [PATCH v1 0/2] clang warning cleanups
@ 2022-12-23 14:24 Ammar Faizi
  2022-12-23 14:24 ` [PATCH v1 1/2] ACPI: Silence missing prototype warnings Ammar Faizi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ammar Faizi @ 2022-12-23 14:24 UTC (permalink / raw)
  To: Robert Moore, Rafael J. Wysocki
  Cc: Ammar Faizi, 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

From: Ammar Faizi <[email protected]>

Hi,

On top of Linus' tree. This series fixes clang warnings.

Base commit: 8395ae05cb5a2e31d36106e8c85efa11cda849be ("Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi")

# Patch 1:

  Compiling with clang-16:

    drivers/acpi/acpi_lpit.c:142:6: error: no previous prototype \
    for function 'acpi_init_lpit' [-Werror,-Wmissing-prototypes]

    drivers/acpi/ioapic.c:212:6: error: no previous prototype \
    for function 'pci_ioapic_remove' [-Werror,-Wmissing-prototypes]

    drivers/acpi/ioapic.c:229:5: error: no previous prototype \
    for function 'acpi_ioapic_remove' [-Werror,-Wmissing-prototypes]

  Include "internal.h" to silence them.

# Patch 2:

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

Signed-off-by: Ammar Faizi <[email protected]>
---

Ammar Faizi (2):
  ACPI: Silence missing prototype warnings
  ACPICA: Silence 'unused-but-set variable' warning

 drivers/acpi/acpi_lpit.c       | 1 +
 drivers/acpi/acpica/nsaccess.c | 4 ++--
 drivers/acpi/ioapic.c          | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)


base-commit: 8395ae05cb5a2e31d36106e8c85efa11cda849be
-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/2] ACPI: Silence missing prototype warnings
  2022-12-23 14:24 [PATCH v1 0/2] clang warning cleanups Ammar Faizi
@ 2022-12-23 14:24 ` Ammar Faizi
  2022-12-30 18:13   ` Rafael J. Wysocki
  2022-12-23 14:24 ` [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning Ammar Faizi
  2022-12-23 15:33 ` [PATCH v1 0/2] clang warning cleanups Ammar Faizi
  2 siblings, 1 reply; 6+ messages in thread
From: Ammar Faizi @ 2022-12-23 14:24 UTC (permalink / raw)
  To: Robert Moore, Rafael J. Wysocki
  Cc: Ammar Faizi, 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

From: Ammar Faizi <[email protected]>

Compiling with clang-16:

  drivers/acpi/acpi_lpit.c:142:6: error: no previous prototype \
  for function 'acpi_init_lpit' [-Werror,-Wmissing-prototypes]

  drivers/acpi/ioapic.c:212:6: error: no previous prototype \
  for function 'pci_ioapic_remove' [-Werror,-Wmissing-prototypes]

  drivers/acpi/ioapic.c:229:5: error: no previous prototype \
  for function 'acpi_ioapic_remove' [-Werror,-Wmissing-prototypes]

Include "internal.h" to silence them.

Cc: LLVM Mailing List <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
 drivers/acpi/acpi_lpit.c | 1 +
 drivers/acpi/ioapic.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
index 50540d4d4948..3843d2576d3f 100644
--- a/drivers/acpi/acpi_lpit.c
+++ b/drivers/acpi/acpi_lpit.c
@@ -10,6 +10,7 @@
 #include <linux/acpi.h>
 #include <asm/msr.h>
 #include <asm/tsc.h>
+#include "internal.h"
 
 struct lpit_residency_info {
 	struct acpi_generic_address gaddr;
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index a690c7b18623..6677955b4a8e 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -24,6 +24,7 @@
 #include <linux/acpi.h>
 #include <linux/pci.h>
 #include <acpi/acpi.h>
+#include "internal.h"
 
 struct acpi_pci_ioapic {
 	acpi_handle	root_handle;
-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning
  2022-12-23 14:24 [PATCH v1 0/2] clang warning cleanups Ammar Faizi
  2022-12-23 14:24 ` [PATCH v1 1/2] ACPI: Silence missing prototype warnings Ammar Faizi
@ 2022-12-23 14:24 ` Ammar Faizi
  2022-12-30 18:17   ` Rafael J. Wysocki
  2022-12-23 15:33 ` [PATCH v1 0/2] clang warning cleanups Ammar Faizi
  2 siblings, 1 reply; 6+ messages in thread
From: Ammar Faizi @ 2022-12-23 14:24 UTC (permalink / raw)
  To: Robert Moore, Rafael J. Wysocki
  Cc: Ammar Faizi, 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

From: Ammar Faizi <[email protected]>

@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 <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/2] clang warning cleanups
  2022-12-23 14:24 [PATCH v1 0/2] clang warning cleanups Ammar Faizi
  2022-12-23 14:24 ` [PATCH v1 1/2] ACPI: Silence missing prototype warnings Ammar Faizi
  2022-12-23 14:24 ` [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning Ammar Faizi
@ 2022-12-23 15:33 ` Ammar Faizi
  2 siblings, 0 replies; 6+ messages in thread
From: Ammar Faizi @ 2022-12-23 15:33 UTC (permalink / raw)
  To: Robert Moore, Rafael J. Wysocki
  Cc: 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

On 12/23/22 9:24 PM, Ammar Faizi wrote:
> Hi,
> 
> On top of Linus' tree. This series fixes clang warnings.

Sorry for the noise. It turned out I messed up my clang compiler flags.
I forgot to do a "git reset --hard" before recompiling.

This has nothing todo with the upstream kernel. Please ignore.

-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] ACPI: Silence missing prototype warnings
  2022-12-23 14:24 ` [PATCH v1 1/2] ACPI: Silence missing prototype warnings Ammar Faizi
@ 2022-12-30 18:13   ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-12-30 18:13 UTC (permalink / raw)
  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

On Fri, Dec 23, 2022 at 3:25 PM Ammar Faizi <[email protected]> wrote:
>
> From: Ammar Faizi <[email protected]>
>
> Compiling with clang-16:
>
>   drivers/acpi/acpi_lpit.c:142:6: error: no previous prototype \
>   for function 'acpi_init_lpit' [-Werror,-Wmissing-prototypes]
>
>   drivers/acpi/ioapic.c:212:6: error: no previous prototype \
>   for function 'pci_ioapic_remove' [-Werror,-Wmissing-prototypes]
>
>   drivers/acpi/ioapic.c:229:5: error: no previous prototype \
>   for function 'acpi_ioapic_remove' [-Werror,-Wmissing-prototypes]
>
> Include "internal.h" to silence them.
>
> Cc: LLVM Mailing List <[email protected]>
> Signed-off-by: Ammar Faizi <[email protected]>
> ---
>  drivers/acpi/acpi_lpit.c | 1 +
>  drivers/acpi/ioapic.c    | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
> index 50540d4d4948..3843d2576d3f 100644
> --- a/drivers/acpi/acpi_lpit.c
> +++ b/drivers/acpi/acpi_lpit.c
> @@ -10,6 +10,7 @@
>  #include <linux/acpi.h>
>  #include <asm/msr.h>
>  #include <asm/tsc.h>
> +#include "internal.h"
>
>  struct lpit_residency_info {
>         struct acpi_generic_address gaddr;
> diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
> index a690c7b18623..6677955b4a8e 100644
> --- a/drivers/acpi/ioapic.c
> +++ b/drivers/acpi/ioapic.c
> @@ -24,6 +24,7 @@
>  #include <linux/acpi.h>
>  #include <linux/pci.h>
>  #include <acpi/acpi.h>
> +#include "internal.h"
>
>  struct acpi_pci_ioapic {
>         acpi_handle     root_handle;
> --

Applied as 6.3 material, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning
  2022-12-23 14:24 ` [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning Ammar Faizi
@ 2022-12-30 18:17   ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-12-30 18:17 UTC (permalink / raw)
  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

On Fri, Dec 23, 2022 at 3:24 PM Ammar Faizi <[email protected]> wrote:
>
> From: Ammar Faizi <[email protected]>
>
> @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 <[email protected]>
> Signed-off-by: Ammar Faizi <[email protected]>

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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-30 18:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 14:24 [PATCH v1 0/2] clang warning cleanups Ammar Faizi
2022-12-23 14:24 ` [PATCH v1 1/2] ACPI: Silence missing prototype warnings Ammar Faizi
2022-12-30 18:13   ` Rafael J. Wysocki
2022-12-23 14:24 ` [PATCH v1 2/2] ACPICA: Silence 'unused-but-set variable' warning Ammar Faizi
2022-12-30 18:17   ` Rafael J. Wysocki
2022-12-23 15:33 ` [PATCH v1 0/2] clang warning cleanups Ammar Faizi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox