From: Clemens Ladisch <clemens@ladisch.de>
To: Torsten Schenk <torsten.schenk@zoho.com>,
Dan Carpenter <error27@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Setting invalid samplerate
Date: Thu, 19 May 2011 12:55:28 +0200 [thread overview]
Message-ID: <4DD4F720.5090706@ladisch.de> (raw)
In-Reply-To: <13007c956d1.7109012681098247941.4235053919533621827@zoho.com>
Torsten Schenk wrote:
> I'm working on the driver for the dmx 6fire usb. ...
> since Ubuntu 11.04, I get complaints about the card not working anymore,
I'd guess that would be commit 82d90313980b:
| ALSA: USB: 6fire: signedness bug in usb6fire_pcm_prepare()
|
| rt->rate is an unsigned char so it's never equal to -1. It's not a huge
| problem because the invalid rate is caught inside the call to
| usb6fire_pcm_set_rate() which returns -EINVAL. But if we fix the test
| then it prints out the correct error message so that's good.
|
| Signed-off-by: Dan Carpenter <error27@gmail.com>
|
| --- a/sound/usb/6fire/pcm.c
| +++ b/sound/usb/6fire/pcm.c
| @@ -493,13 +493,12 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
| sub->period_off = 0;
|
| if (rt->stream_state == STREAM_DISABLED) {
| - rt->rate = -1;
| for (i = 0; i < ARRAY_SIZE(rates); i++)
| if (alsa_rt->rate == rates[i]) {
| rt->rate = i;
| break;
| }
| - if (rt->rate == -1) {
| + if (i == ARRAY_SIZE(rates)) {
| mutex_unlock(&rt->stream_mutex);
| snd_printk("invalid rate %d in prepare.\n",
| alsa_rt->rate);
This fixed not a bug but just a symptom of the actual bug, that rt->rate
is not signed.
There are still "rt->rate = -1" initializations, and usb6fire_pcm_open()
then does:
if (rt->rate >= 0)
alsa_rt->hw.rates = rates_alsaid[rt->rate];
Regards,
Clemens
next prev parent reply other threads:[~2011-05-19 10:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 13:46 [PATCH] ALSA: HDA: Add jack detection for HDMI David Henningsson
2011-05-17 15:46 ` Takashi Iwai
2011-05-19 9:55 ` David Henningsson
2011-05-19 10:06 ` Takashi Iwai
2011-05-19 10:24 ` Setting invalid samplerate Torsten Schenk
2011-05-19 10:32 ` Torsten Schenk
2011-05-19 10:55 ` Clemens Ladisch [this message]
2011-05-19 11:28 ` Torsten Schenk
2011-05-19 11:36 ` Daniel Mack
2011-05-23 21:49 ` [PATCH] ALSA: HDA: Add jack detection for HDMI Stephen Warren
2011-05-24 5:39 ` Takashi Iwai
2011-05-24 17:27 ` Stephen Warren
2011-05-24 18:09 ` Takashi Iwai
2011-05-24 19:18 ` Stephen Warren
2011-05-24 21:00 ` Stephen Warren
2011-05-19 16:57 ` Stephen Warren
2011-05-19 22:45 ` David Henningsson
2011-05-19 22:51 ` Stephen Warren
2011-06-09 20:59 ` Stephen Warren
2011-05-17 16:00 ` Stephen Warren
2011-05-17 16:08 ` Takashi Iwai
2011-05-17 17:09 ` pl bossart
2011-05-17 17:31 ` Takashi Iwai
2011-05-17 20:51 ` pl bossart
2011-05-17 21:42 ` Stephen Warren
2011-05-17 22:11 ` pl bossart
2011-05-17 23:14 ` Stephen Warren
2011-05-18 15:43 ` pl bossart
2011-05-18 15:49 ` Takashi Iwai
2011-05-18 10:02 ` Takashi Iwai
2011-05-20 21:59 ` Stephen Warren
2011-05-21 6:25 ` David Henningsson
2011-05-21 7:37 ` Takashi Iwai
2011-05-23 15:29 ` Stephen Warren
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=4DD4F720.5090706@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=error27@gmail.com \
--cc=torsten.schenk@zoho.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;
as well as URLs for NNTP newsgroup(s).