Skip to contentSkip to conversation

audio: Fix warning from static code analysis

PATCH Applied Stefan Weil 2 participants 3 messages Sep 3, 2012 – Sep 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio: Fix warning from static code analysis

smatch report:
audio/audio_template.h:416 AUD_open_out(18) warn:
variable dereferenced before check 'as' (see line 414)

Moving the ldebug statement after the statement which checks 'as' fixes that warning.

---

This patch fails when checked by checkpatch.pl because it preserves the coding style used for QEMU audio code.

Please apply the patch after QEMU 1.2 was released.

Thanks,

Stefan Weil

 audio/audio_template.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
audio/audio_template.h +3 -3
index 519432a..16f7880 100644
@@ -410,15 +410,15 @@ SW *glue (AUD_open_, TYPE) (
     SW *old_sw = NULL;
 #endif
 
-    ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
-            name, as->freq, as->nchannels, as->fmt);
-
     if (audio_bug (AUDIO_FUNC, !card || !name || !callback_fn || !as)) {
         dolog ("card=%p name=%p callback_fn=%p as=%p\n",
                card, name, callback_fn, as);
         goto fail;
     }
 
+    ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
+            name, as->freq, as->nchannels, as->fmt);
+
     if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) {
         audio_print_settings (as);
         goto fail;
Signature · 1 line
1.7.10
#1 lore raw

Am 03.09.2012 21:25, schrieb Stefan Weil:

Quoted 36 lines

smatch report:
audio/audio_template.h:416 AUD_open_out(18) warn:
variable dereferenced before check 'as' (see line 414)

Moving the ldebug statement after the statement which checks 'as' fixes that warning.

---

This patch fails when checked by checkpatch.pl because it preserves the coding style used for QEMU audio code.

Please apply the patch after QEMU 1.2 was released.

Thanks,

Stefan Weil

  audio/audio_template.h |    6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
audio/audio_template.h +0 -3
index 519432a..16f7880 100644
@@ -410,15 +410,15 @@ SW *glue (AUD_open_, TYPE) (
      SW *old_sw = NULL;
  #endif
 
-    ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
-            name, as->freq, as->nchannels, as->fmt);
-
      if (audio_bug (AUDIO_FUNC, !card || !name || !callback_fn || !as)) {
          dolog ("card=%p name=%p callback_fn=%p as=%p\n",

audio/audio_template.h SW *glue (AUD_open_, TYPE) ( · line 424

Quoted 10 lines
audio/audio_template.h +3 -0
                 card, name, callback_fn, as);
          goto fail;
      }
 
+    ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
+            name, as->freq, as->nchannels, as->fmt);
+
      if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) {
          audio_print_settings (as);
          goto fail;

Ping?

Applied
#2 lore raw
Quoted 10 lines · Stefan Weil

Am 03.09.2012 21:25, schrieb Stefan Weil:

Quoted 9 lines

smatch report:
audio/audio_template.h:416 AUD_open_out(18) warn:
variable dereferenced before check 'as' (see line 414)

Moving the ldebug statement after the statement which checks 'as' fixes that warning.

---

Applied, thanks.

[..snip..]

Signature · 1 line
mailto:[email protected]