All of lore.kernel.org
 help / color / mirror / Atom feed
From: Torsten Schenk <torsten.schenk@zoho.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: [PATCH 2/5] TerraTec DMX 6Fire USB updates
Date: Mon, 04 Apr 2011 11:47:50 +0200	[thread overview]
Message-ID: <12f1fe94164.2149959721155252826.2622803794267683702@zoho.com> (raw)
In-Reply-To: <s5hwrjamq64.wl%tiwai@suse.de>

Completion of signedness bug for pcm_runtime.rate: variable will never get assigned a negative value now.

Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com>

diff -Nur a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
--- a/sound/usb/6fire/pcm.c	2011-04-04 11:17:56.469832999 +0200
+++ b/sound/usb/6fire/pcm.c	2011-04-04 11:23:12.993833002 +0200
@@ -456,7 +456,7 @@
 		/* all substreams closed? if so, stop streaming */
 		if (!rt->playback.instance && !rt->capture.instance) {
 			usb6fire_pcm_stream_stop(rt);
-			rt->rate = -1;
+			rt->rate = ARRAY_SIZE(rates);
 		}
 	}
 	mutex_unlock(&rt->stream_mutex);
@@ -480,7 +480,6 @@
 	struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub);
 	struct pcm_substream *sub = usb6fire_pcm_get_substream(alsa_sub);
 	struct snd_pcm_runtime *alsa_rt = alsa_sub->runtime;
-	int i;
 	int ret;
 
 	if (rt->panic)
@@ -493,12 +492,10 @@
 	sub->period_off = 0;
 
 	if (rt->stream_state == STREAM_DISABLED) {
-		for (i = 0; i < ARRAY_SIZE(rates); i++)
-			if (alsa_rt->rate == rates[i]) {
-				rt->rate = i;
+		for (rt->rate = 0; rt->rate < ARRAY_SIZE(rates); rt->rate++)
+			if (alsa_rt->rate == rates[rt->rate])
 				break;
-			}
-		if (i == ARRAY_SIZE(rates)) {
+		if (rt->rate == ARRAY_SIZE(rates)) {
 			mutex_unlock(&rt->stream_mutex);
 			snd_printk("invalid rate %d in prepare.\n",
 					alsa_rt->rate);
@@ -613,7 +610,7 @@
 
 	rt->chip = chip;
 	rt->stream_state = STREAM_DISABLED;
-	rt->rate = -1;
+	rt->rate = ARRAY_SIZE(rates);
 	init_waitqueue_head(&rt->stream_wait_queue);
 	mutex_init(&rt->stream_mutex);

  parent reply	other threads:[~2011-04-04  9:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12d995c1fa0.477955495632923443.5387390398635058860@zoho.com>
2011-01-20 16:54 ` Driver for TerraTec DMX 6Fire USB Takashi Iwai
2011-01-20 22:38   ` Torsten Schenk
2011-01-21  8:57     ` Takashi Iwai
2011-01-21 11:48       ` Torsten Schenk
2011-01-22 16:35         ` Takashi Iwai
2011-01-24 12:10           ` Torsten Schenk
2011-01-25 10:25             ` Takashi Iwai
2011-01-25 14:12               ` Torsten Schenk
2011-03-31 19:25         ` TerraTec DMX 6Fire USB updates Torsten Schenk
2011-04-01 12:52           ` Takashi Iwai
2011-04-03 12:30             ` Torsten Schenk
2011-04-04  7:28               ` Takashi Iwai
2011-04-04  9:41                 ` Torsten Schenk
2011-04-04  9:45                 ` [PATCH 1/5] " Torsten Schenk
2011-04-04 10:29                   ` Takashi Iwai
2011-04-04  9:47                 ` Torsten Schenk [this message]
2011-04-04  9:49                 ` [PATCH 3/5] " Torsten Schenk
2011-04-04  9:49                 ` [PATCH 4/5] " Torsten Schenk
2011-04-04  9:50                 ` [PATCH 5/5] " Torsten Schenk
2011-06-16 19:06             ` [PATCH] final issues in snd-usb-6fire concerning signedness bug Torsten Schenk
2011-06-16 19:33               ` 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=12f1fe94164.2149959721155252826.2622803794267683702@zoho.com \
    --to=torsten.schenk@zoho.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.