Skip to contentSkip to conversation

uml: audio: fix -Wmissing-variable-declarations

PATCH Superseded Nick Desaulniers 1 participant 2 messages Aug 8, 2023 User-mode Linux (UML)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uml: audio: fix -Wmissing-variable-declarations

I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day bot spotted the following instance:

arch/um/drivers/hostaudio_kern.c:316:3: warning: no previous extern declaration for non-static variable 'module_data' [-Wmissing-variable-declarations]

  } module_data;
    ^

arch/um/drivers/hostaudio_kern.c:313:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit struct {
^

This symbol is not referenced by more than one translation unit, so give it static storage.

---
 arch/um/drivers/hostaudio_kern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/hostaudio_kern.c +1 -1
index 5b064d360cb7..c42b793bce65 100644
@@ -310,7 +310,7 @@ static const struct file_operations hostmixer_fops = {
 	.release        = hostmixer_release,
 };
 
-struct {
+static struct {
 	int dev_audio;
 	int dev_mixer;
 } module_data;

---
base-commit: 14f9643dc90adea074a0ffb7a17d337eafc6a5cc
change-id: 20230808-um_hostaudio-21d7207deaed

Best regards,

Signature · 1 line
Nick Desaulniers <[email protected]>
#1 lore raw
Quoted 14 lines · Nick Desaulniers

I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day bot spotted the following instance:

arch/um/drivers/hostaudio_kern.c:316:3: warning: no previous extern declaration for non-static variable 'module_data' [-Wmissing-variable-declarations]

  } module_data;
    ^

arch/um/drivers/hostaudio_kern.c:313:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit struct {
^

Quoted 5 lines

This symbol is not referenced by more than one translation unit, so give it static storage.

^ D'oh, wrong report, this should be
https://lore.kernel.org/llvm/[email protected]/
Resending.

Quoted 27 lines
---
 arch/um/drivers/hostaudio_kern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/hostaudio_kern.c +1 -2
index 5b064d360cb7..c42b793bce65 100644
@@ -310,7 +310,7 @@ static const struct file_operations hostmixer_fops = {
        .release        = hostmixer_release,
 };
 
-struct {
+static struct {
        int dev_audio;
        int dev_mixer;
 } module_data;
 
---

base-commit: 14f9643dc90adea074a0ffb7a17d337eafc6a5cc
change-id: 20230808-um_hostaudio-21d7207deaed

Best regards,
--
Nick Desaulniers <[email protected]>

Signature · 2 lines
Thanks,
~Nick Desaulniers