From: Eldad Zack <eldad@fogrefinery.com>
To: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Cc: Eldad Zack <eldad@fogrefinery.com>,
Daniel Mack <zonque@gmail.com>,
Clemens Ladisch <clemens@ladisch.de>
Subject: [PATCH, for-next 2/2] ALSA: asihpi: add format support check in snd_card_asihpi_capture_formats
Date: Tue, 23 Apr 2013 01:00:42 +0200 [thread overview]
Message-ID: <1366671642-30423-2-git-send-email-eldad@fogrefinery.com> (raw)
In-Reply-To: <1366671642-30423-1-git-send-email-eldad@fogrefinery.com>
Some Asihpi formats are not supported or invalid, and their mapping to
ALSA format is set to -1.
Before performing the format conversion into ALSA bitwise formats,
add a consistency check for the requested format, as done in
snd_card_asihpi_playback_formats().
Compile tested only.
Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
---
sound/pci/asihpi/asihpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 160cf83..fbc1720 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -1141,7 +1141,7 @@ static u64 snd_card_asihpi_capture_formats(struct snd_card_asihpi *asihpi,
format, sample_rate, 128000, 0);
if (!err)
err = hpi_instream_query_format(h_stream, &hpi_format);
- if (!err)
+ if (!err && (hpi_to_alsa_formats[format] != -1))
formats |= pcm_format_to_bits(hpi_to_alsa_formats[format]);
}
return formats;
--
1.8.1.5
prev parent reply other threads:[~2013-04-22 23:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-21 23:44 [PATCH, for-next] ALSA: usb-audio: use FMTBITs in parse_audio_format_i Eldad Zack
2013-04-22 8:51 ` Takashi Iwai
2013-04-22 11:29 ` Eldad Zack
2013-04-22 11:34 ` Takashi Iwai
2013-04-22 11:47 ` Eldad Zack
2013-04-22 11:49 ` Takashi Iwai
2013-04-22 23:00 ` [PATCH, for-next 1/2] ALSA: pcm_format_to_bits strong-typed conversion Eldad Zack
2013-04-22 23:00 ` Eldad Zack [this message]
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=1366671642-30423-2-git-send-email-eldad@fogrefinery.com \
--to=eldad@fogrefinery.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=tiwai@suse.de \
--cc=zonque@gmail.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