ALSA: core: Unify card allocation and free with and without devres
We implemented devres for allocating and releasing the card memory
itself, but this can be problematic when the delayed kobj release is
used. Above all, the conditional kfree() is rather error-prone.
This patch changes the mechanism for snd_devm_card_new(). Now it
allocates a devres pointer for the card object that stores the result
of snd_card_new(). In return, at devres release, it unreferences the
card_dev refcount, so that we can use card_dev's release as the sole
point for releasing the memory at the very last.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 file changed