mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
ALSA: sis7019: Fix the missing error handling
The previous cleanup with devres forgot to replace the snd_card_free()
call with the devm version. Moreover, it still needs the manual call
of snd_card_free() at the probe error path, otherwise the reverse
order of the releases may happen. This patch addresses those issues.
Fixes: 499ddc1639
("ALSA: sis7019: Allocate resources with device-managed APIs")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220412102636.16000-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -1331,8 +1331,8 @@ static int sis_chip_create(struct snd_card *card,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_sis7019_probe(struct pci_dev *pci,
|
static int __snd_sis7019_probe(struct pci_dev *pci,
|
||||||
const struct pci_device_id *pci_id)
|
const struct pci_device_id *pci_id)
|
||||||
{
|
{
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
struct sis7019 *sis;
|
struct sis7019 *sis;
|
||||||
@@ -1352,8 +1352,8 @@ static int snd_sis7019_probe(struct pci_dev *pci,
|
|||||||
if (!codecs)
|
if (!codecs)
|
||||||
codecs = SIS_PRIMARY_CODEC_PRESENT;
|
codecs = SIS_PRIMARY_CODEC_PRESENT;
|
||||||
|
|
||||||
rc = snd_card_new(&pci->dev, index, id, THIS_MODULE,
|
rc = snd_devm_card_new(&pci->dev, index, id, THIS_MODULE,
|
||||||
sizeof(*sis), &card);
|
sizeof(*sis), &card);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
@@ -1386,6 +1386,12 @@ static int snd_sis7019_probe(struct pci_dev *pci,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int snd_sis7019_probe(struct pci_dev *pci,
|
||||||
|
const struct pci_device_id *pci_id)
|
||||||
|
{
|
||||||
|
return snd_card_free_on_error(&pci->dev, __snd_sis7019_probe(pci, pci_id));
|
||||||
|
}
|
||||||
|
|
||||||
static struct pci_driver sis7019_driver = {
|
static struct pci_driver sis7019_driver = {
|
||||||
.name = KBUILD_MODNAME,
|
.name = KBUILD_MODNAME,
|
||||||
.id_table = snd_sis7019_ids,
|
.id_table = snd_sis7019_ids,
|
||||||
|
Reference in New Issue
Block a user