mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: trix@redhat.com
To: perex@perex.cz, tiwai@suse.com, gustavoars@kernel.org
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Tom Rix <trix@redhat.com>
Subject: [PATCH] ALSA: usb-audio: initialize the cur variable
Date: Fri, 21 May 2021 12:46:03 -0700	[thread overview]
Message-ID: <20210521194603.2077623-1-trix@redhat.com> (raw)

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem
clock.c:338:10: warning: The right operand of '=='
  is a garbage value
    if (i == cur)
          ^  ~~~

In __uac_clock_find_source() the goto find_others skips over
setting of the 'cur' variable.  Since the pin loop variable
starts with 1, it is safe to initialize cur to 0.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 sound/usb/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 772478c725c2e..edc458c50bf2c 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -258,9 +258,10 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
 	union uac23_clock_source_desc *source;
 	union uac23_clock_selector_desc *selector;
 	union uac23_clock_multiplier_desc *multiplier;
-	int ret, i, cur, err, pins, clock_id;
+	int ret, i, err, pins, clock_id;
 	const u8 *sources;
 	int proto = fmt->protocol;
+	int cur = 0;
 
 	entity_id &= 0xff;
 
-- 
2.26.3


             reply	other threads:[~2021-05-21 19:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 19:46 trix [this message]
2021-05-22  6:46 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210521194603.2077623-1-trix@redhat.com \
    --to=trix@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®