Skip to contentSkip to conversation

mISDN: Mark local variable 'incomplete' as __maybe_unused in dsp_pipeline_build()

PATCH In review Zhen Lei 2 participants 4 messages May 19, 2021 – May 20, 2021

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 mISDN: Mark local variable 'incomplete' as __maybe_unused in dsp_pipeline_build()

GCC reports the following warning with W=1:

drivers/isdn/mISDN/dsp_pipeline.c:221:6: warning:
variable 'incomplete' set but not used [-Wunused-but-set-variable]

  221 |  int incomplete = 0, found = 0;
      |      ^~~~~~~~~~

This variable is used only when macro PIPELINE_DEBUG is defined.

---
 drivers/isdn/mISDN/dsp_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/mISDN/dsp_pipeline.c +1 -1
index 40588692cec7..6a31f6879da8 100644
@@ -218,7 +218,7 @@ void dsp_pipeline_destroy(struct dsp_pipeline *pipeline)
 
 int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg)
 {
-	int incomplete = 0, found = 0;
+	int __maybe_unused incomplete = 0, found = 0;
 	char *dup, *tok, *name, *args;
 	struct dsp_element_entry *entry, *n;
 	struct dsp_pipeline_entry *pipeline_entry;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Zhen Lei

GCC reports the following warning with W=1:

drivers/isdn/mISDN/dsp_pipeline.c:221:6: warning:
variable 'incomplete' set but not used [-Wunused-but-set-variable]

  221 |  int incomplete = 0, found = 0;
      |      ^~~~~~~~~~

This variable is used only when macro PIPELINE_DEBUG is defined.

That define is commented 13 years ago and can be seen as a dead code that should be removed.

Thanks

Quoted 24 lines
---
 drivers/isdn/mISDN/dsp_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/mISDN/dsp_pipeline.c +1 -1
index 40588692cec7..6a31f6879da8 100644
@@ -218,7 +218,7 @@ void dsp_pipeline_destroy(struct dsp_pipeline *pipeline)
 
 int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg)
 {
-	int incomplete = 0, found = 0;
+	int __maybe_unused incomplete = 0, found = 0;
 	char *dup, *tok, *name, *args;
 	struct dsp_element_entry *entry, *n;
 	struct dsp_pipeline_entry *pipeline_entry;
Signature · 1 line
2.25.1
#2 lore raw
Quoted 8 lines · Leon Romanovsky
Quoted 7 lines · Zhen Lei

GCC reports the following warning with W=1:

drivers/isdn/mISDN/dsp_pipeline.c:221:6: warning:
variable 'incomplete' set but not used [-Wunused-but-set-variable]

  221 |  int incomplete = 0, found = 0;
      |      ^~~~~~~~~~
Quoted 4 lines
Quoted 1 line

This variable is used only when macro PIPELINE_DEBUG is defined.

That define is commented 13 years ago and can be seen as a dead code that should be removed.

OK, I will remove it in V2. Actually, every time incomplete=1, a KERN_ERR message is printed in advance. The only new information is the 'cfg'.

Quoted 30 lines

Thanks

Quoted 24 lines
---
 drivers/isdn/mISDN/dsp_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/mISDN/dsp_pipeline.c +1 -1
index 40588692cec7..6a31f6879da8 100644
@@ -218,7 +218,7 @@ void dsp_pipeline_destroy(struct dsp_pipeline *pipeline)
 
 int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg)
 {
-	int incomplete = 0, found = 0;
+	int __maybe_unused incomplete = 0, found = 0;
 	char *dup, *tok, *name, *args;
 	struct dsp_element_entry *entry, *n;
 	struct dsp_pipeline_entry *pipeline_entry;
Signature · 1 line
2.25.1

.

#3 lore raw
Quoted 11 lines · Leizhen (ThunderTown)
Quoted 8 lines · Leon Romanovsky
Quoted 7 lines · Zhen Lei

GCC reports the following warning with W=1:

drivers/isdn/mISDN/dsp_pipeline.c:221:6: warning:
variable 'incomplete' set but not used [-Wunused-but-set-variable]

  221 |  int incomplete = 0, found = 0;
      |      ^~~~~~~~~~
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

This variable is used only when macro PIPELINE_DEBUG is defined.

That define is commented 13 years ago and can be seen as a dead code that should be removed.

OK, I will remove it in V2. Actually, every time incomplete=1, a KERN_ERR message is printed in advance. The only new information is the 'cfg'.

Wow, Do you mean remove all "#ifdef PIPELINE_DEBUG" debug information? I will clean them.

Quoted 31 lines
Quoted 31 lines

Thanks

Quoted 24 lines
---
 drivers/isdn/mISDN/dsp_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/mISDN/dsp_pipeline.c +1 -1
index 40588692cec7..6a31f6879da8 100644
@@ -218,7 +218,7 @@ void dsp_pipeline_destroy(struct dsp_pipeline *pipeline)
 
 int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg)
 {
-	int incomplete = 0, found = 0;
+	int __maybe_unused incomplete = 0, found = 0;
 	char *dup, *tok, *name, *args;
 	struct dsp_element_entry *entry, *n;
 	struct dsp_pipeline_entry *pipeline_entry;
Signature · 1 line
2.25.1

.