Home
last modified time | relevance | path

Searched hist:fee2b871 (Results 1 – 2 of 2) sorted by relevance

/openbmc/linux/include/sound/
H A Dcore.hfee2b871 Tue Apr 12 04:31:40 CDT 2022 Takashi Iwai <tiwai@suse.de> ALSA: core: Add snd_card_free_on_error() helper

This is a small helper function to handle the error path more easily
when an error happens during the probe for the device with the
device-managed card. Since devres releases in the reverser order of
the creations, usually snd_card_free() gets called at the last in the
probe error path unless it already reached snd_card_register() calls.
Due to this nature, when a driver expects the resource releases in
card->private_free, this might be called too lately.

As a workaround, one should call the probe like:

static int __some_probe(...) { // do real probe.... }

static int some_probe(...)
{
return snd_card_free_on_error(dev, __some_probe(dev, ...));
}

so that the snd_card_free() is called explicitly at the beginning of
the error path from the probe.

This function will be used in the upcoming fixes to address the
regressions by devres usages.

Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220412093141.8008-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
/openbmc/linux/sound/core/
H A Dinit.cfee2b871 Tue Apr 12 04:31:40 CDT 2022 Takashi Iwai <tiwai@suse.de> ALSA: core: Add snd_card_free_on_error() helper

This is a small helper function to handle the error path more easily
when an error happens during the probe for the device with the
device-managed card. Since devres releases in the reverser order of
the creations, usually snd_card_free() gets called at the last in the
probe error path unless it already reached snd_card_register() calls.
Due to this nature, when a driver expects the resource releases in
card->private_free, this might be called too lately.

As a workaround, one should call the probe like:

static int __some_probe(...) { // do real probe.... }

static int some_probe(...)
{
return snd_card_free_on_error(dev, __some_probe(dev, ...));
}

so that the snd_card_free() is called explicitly at the beginning of
the error path from the probe.

This function will be used in the upcoming fixes to address the
regressions by devres usages.

Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220412093141.8008-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>