From: Daniel Mack <daniel@zonque.org>
To: Damien Zammit <damien.zammit@gmail.com>
Cc: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [PATCH] ALSA: usb-audio - Capture and duplex support for Digidesign Mbox 1 sound card.
Date: Mon, 03 Mar 2014 22:01:21 +0100 [thread overview]
Message-ID: <5314EDA1.5040101@zonque.org> (raw)
In-Reply-To: <52E5CC2E.1010000@gmail.com>
Hi Damien,
Thanks for your patch! See my two comments below.
On 01/27/2014 04:02 AM, Damien Zammit wrote:
> On 27/01/14 03:52, Clemens Ladisch wrote:
>>> >> This patch creates a dual endpoint quirk.
>>>> >> >The quirk interface needs a second audioformat struct for this to work
>>>> >> >which I called ".data2".
>> > Couldn't you just let .data point to an array of two structs?
> Thanks Clemens, I have created a new patch using this suggestion.
[...]
> + fp2 = kmemdup((const struct audioformat*)(quirk->data + sizeof(const struct audioformat)), sizeof(*fp2), GFP_KERNEL);
> + if (!fp2) {
> + snd_printk(KERN_ERR "cannot memdup 2\n");
> + return -ENOMEM;
> + }
> + if (fp1->nr_rates > MAX_NR_RATES) {
> + kfree(fp1);
> + kfree(fp2);
Please do proper error unwinding here with jump labels rather than
open-coding the kfree() calls from multiple places.
Also, I wonder whether a more generic quirk type to set up a dynamic
number of fixed interfaces wouldn't be nicer. IOW, add a field to struct
snd_usb_audio_quirk to denote the number of array members in quirk->data
and call the quirk type QUIRK_AUDIO_FIXED_MULTI_ENDPOINT or something.
Then, rewrite the logic to iterate over the interfaces in a loop. That
might also make the code more readable.
Thanks,
Daniel
next prev parent reply other threads:[~2014-03-03 21:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-26 15:10 [PATCH] ALSA: usb-audio - Capture and duplex support for Digidesign Mbox 1 sound card Damien Zammit
2014-01-26 15:30 ` Damien Zammit
2014-01-26 16:52 ` Clemens Ladisch
2014-01-27 3:02 ` Damien Zammit
2014-03-01 7:40 ` Damien Zammit
2014-03-03 21:01 ` Daniel Mack [this message]
2014-03-29 5:01 ` Mark Hills
2014-03-29 12:27 ` [alsa-devel] " Damien Zammit
2014-03-29 22:57 ` Mark Hills
2014-03-30 3:21 ` Damien Zammit
2014-03-31 17:47 ` Daniel Mack
2014-04-01 2:41 ` Damien Zammit
2014-03-29 5:35 ` Damien Zammit
2014-03-31 17:58 ` Daniel Mack
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=5314EDA1.5040101@zonque.org \
--to=daniel@zonque.org \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=damien.zammit@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