[alsa-devel] RFC: snd_card_create() function

Krzysztof Helt krzysztof.h1 at poczta.fm
Mon Jan 12 17:08:28 CET 2009

On Mon, 12 Jan 2009 15:35:19 +0100
Takashi Iwai <tiwai at suse.de> wrote:

> Hi,
> so far, we use snd_card_new() function to create a card instance.
> A known problem regarding this API is that it doesn't return a proper
> error code, thus the probe callback always returns -ENOMEM (or
> whatever the driver defines) no matter which error occurred actually.
> A typical case is the card slot conflict.  Even in such a case, it
> returns -ENOMEM, which may mislead the user.

Another approach is PTR_ERR macro used already in the kernel
(see include/linux/err.h).
It encodes the error code in the returned pointer value. There
are already hndy macros/inlines to get this code, test error, etc.


Speak Up. Angielski szybko i skutecznie. 3 miesiace nauki gratis.
Sprawdz. >> http://link.interia.pl/f2019

More information about the Alsa-devel mailing list