ALSA: Fix error handling order at probe error
Subsystems (5)
cover ALSA: Fix error handling order at probe error
Hi,
this is a bunch of additional fixes that are similar like the previous patch set for echoaudio but applied to other drivers that suffer from the very same issue -- the incorrect error handling order at the probe error.
Most of patches just follow the same strategy, the use of the new snd_card_free_on_error() helper while some few took just the manual snd_card_free() call and some with shuffling the private_free setup for avoiding the problem.
Takashi
===
Takashi Iwai (39):
ALSA: galaxy: Fix the missing snd_card_free() call at probe error
ALSA: sc6000: Fix the missing snd_card_free() call at probe error
ALSA: ad1889: Fix the missing snd_card_free() call at probe error
ALSA: ali5451: Fix the missing snd_card_free() call at probe error
ALSA: als4000: Fix the missing snd_card_free() call at probe error
ALSA: atiixp: Fix the missing snd_card_free() call at probe error
ALSA: au88x0: Fix the missing snd_card_free() call at probe error
ALSA: azt3328: Fix the missing snd_card_free() call at probe error
ALSA: ca0106: Fix the missing snd_card_free() call at probe error
ALSA: cs4281: Fix the missing snd_card_free() call at probe error
ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error
ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error
ALSA: ens137x: Fix the missing snd_card_free() call at probe error
ALSA: es1938: Fix the missing snd_card_free() call at probe error
ALSA: es1968: Fix the missing snd_card_free() call at probe error
ALSA: fm801: Fix the missing snd_card_free() call at probe error
ALSA: ice1724: Fix the missing snd_card_free() call at probe error
ALSA: intel8x0: Fix the missing snd_card_free() call at probe error
ALSA: korg1212: Fix the missing snd_card_free() call at probe error
ALSA: maestro3: Fix the missing snd_card_free() call at probe error
ALSA: riptide: Fix the missing snd_card_free() call at probe error
ALSA: rme32: Fix the missing snd_card_free() call at probe error
ALSA: rme96: Fix the missing snd_card_free() call at probe error
ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error
ALSA: via82xx: Fix the missing snd_card_free() call at probe error
ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error
ALSA: sis7019: Fix the missing error handling
ALSA: bt87x: Fix the missing snd_card_free() call at probe error
ALSA: lola: Fix the missing snd_card_free() call at probe error
ALSA: als300: Fix the missing snd_card_free() call at probe error
ALSA: aw2: Fix the missing snd_card_free() call at probe error
ALSA: cmipci: Fix the missing snd_card_free() call at probe error
ALSA: lx6464es: Fix the missing snd_card_free() call at probe error
ALSA: oxygen: Fix the missing snd_card_free() call at probe error
ALSA: hdsp: Fix the missing snd_card_free() call at probe error
ALSA: hdspm: Fix the missing snd_card_free() call at probe error
ALSA: rme9652: Fix the missing snd_card_free() call at probe error
ALSA: mtpav: Don't call card private_free at probe error path
ALSA: nm256: Don't call card private_free at probe error path
sound/drivers/mtpav.c | 4 ++-- sound/isa/galaxy/galaxy.c | 7 ++++++- sound/isa/sc6000.c | 7 ++++++- sound/pci/ad1889.c | 10 ++++++++-- sound/pci/ali5451/ali5451.c | 10 ++++++++-- sound/pci/als300.c | 8 ++++++-- sound/pci/als4000.c | 10 ++++++++-- sound/pci/atiixp.c | 10 ++++++++-- sound/pci/atiixp_modem.c | 10 ++++++++-- sound/pci/au88x0/au88x0.c | 8 +++++++- sound/pci/aw2/aw2-alsa.c | 8 ++++++-- sound/pci/azt3328.c | 8 +++++++- sound/pci/bt87x.c | 10 ++++++++-- sound/pci/ca0106/ca0106_main.c | 10 ++++++++-- sound/pci/cmipci.c | 8 ++++++-- sound/pci/cs4281.c | 10 ++++++++-- sound/pci/cs5535audio/cs5535audio.c | 10 ++++++++-- sound/pci/emu10k1/emu10k1x.c | 10 ++++++++-- sound/pci/ens1370.c | 10 ++++++++-- sound/pci/es1938.c | 10 ++++++++-- sound/pci/es1968.c | 10 ++++++++-- sound/pci/fm801.c | 10 ++++++++-- sound/pci/ice1712/ice1724.c | 10 ++++++++-- sound/pci/intel8x0.c | 10 ++++++++-- sound/pci/intel8x0m.c | 10 ++++++++-- sound/pci/korg1212/korg1212.c | 8 ++++++-- sound/pci/lola/lola.c | 10 ++++++++-- sound/pci/lx6464es/lx6464es.c | 8 ++++++-- sound/pci/maestro3.c | 8 +++++++- sound/pci/nm256/nm256.c | 2 +- sound/pci/oxygen/oxygen_lib.c | 12 +++++++++++- sound/pci/riptide/riptide.c | 8 +++++++- sound/pci/rme32.c | 8 +++++++- sound/pci/rme96.c | 10 ++++++++-- sound/pci/rme9652/hdsp.c | 8 ++++++-- sound/pci/rme9652/hdspm.c | 8 ++++++-- sound/pci/rme9652/rme9652.c | 8 ++++++-- sound/pci/sis7019.c | 14 ++++++++++---- sound/pci/sonicvibes.c | 10 ++++++++-- sound/pci/via82xx.c | 10 ++++++++-- sound/pci/via82xx_modem.c | 10 ++++++++-- sound/x86/intel_hdmi_audio.c | 7 ++++++- 42 files changed, 301 insertions(+), 76 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/39 ALSA: galaxy: Fix the missing snd_card_free() call at probe error
The previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/isa/galaxy/galaxy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/isa/galaxy/galaxy.c +6 -1
@@ -478,7 +478,7 @@ static void snd_galaxy_free(struct snd_card *card)galaxy_set_config (galaxy, galaxy->config); } -static int snd_galaxy_probe (struct device *dev,unsigned int n) +static int __snd_galaxy_probe (struct device *dev,unsigned int n) {struct snd_galaxy *galaxy;struct snd_wss *chip;
@@ -598,6 +598,11 @@ static int snd_galaxy_probe(struct device *dev, unsigned int n)return 0 ; } +static int snd_galaxy_probe (struct device *dev,unsigned int n) +{ +return snd_card_free_on_error (dev,__snd_galaxy_probe (dev, n)); +} +static struct isa_driver snd_galaxy_driver = { .match = snd_galaxy_match, .probe = snd_galaxy_probe,
Signature · 1 line
2.31.1
PATCH 2/39 ALSA: sc6000: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/isa/sc6000.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/isa/sc6000.c +6 -1
@@ -537,7 +537,7 @@ static void snd_sc6000_free(struct snd_card *card)sc6000_setup_board (vport,0 ); } -static int snd_sc6000_probe (struct device *devptr,unsigned int dev) +static int __snd_sc6000_probe (struct device *devptr,unsigned int dev) {static const int possible_irqs[] = {5 ,7 ,9 ,10 ,11 ,-1 };static const int possible_dmas[] = {1 ,3 ,0 ,-1 };
@@ -662,6 +662,11 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev)return 0 ; } +static int snd_sc6000_probe (struct device *devptr,unsigned int dev) +{ +return snd_card_free_on_error (devptr,__snd_sc6000_probe (devptr, dev)); +} +static struct isa_driver snd_sc6000_driver = { .match = snd_sc6000_match, .probe = snd_sc6000_probe,
Signature · 1 line
2.31.1
PATCH 3/39 ALSA: ad1889: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/ad1889.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/ad1889.c +8 -2
@@ -844,8 +844,8 @@ snd_ad1889_create(struct snd_card *card, struct pci_dev *pci) }static int -snd_ad1889_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +__snd_ad1889_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {int err;static int devno;
@@ -904,6 +904,12 @@ snd_ad1889_probe(struct pci_dev *pci,return 0 ; } +static int snd_ad1889_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_ad1889_probe (pci, pci_id)); +} +static const struct pci_device_id snd_ad1889_ids[] = { {PCI_DEVICE (PCI_VENDOR_ID_ANALOG_DEVICES ,PCI_DEVICE_ID_AD1889JS ) }, {0 , },
Signature · 1 line
2.31.1
PATCH 4/39 ALSA: ali5451: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe recent cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/ali5451/ali5451.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/ali5451/ali5451.c +8 -2
@@ -2124,8 +2124,8 @@ static int snd_ali_create(struct snd_card *card,return 0 ; } -static int snd_ali_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_ali_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct snd_ali *codec;
@@ -2170,6 +2170,12 @@ static int snd_ali_probe(struct pci_dev *pci,return 0 ; } +static int snd_ali_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_ali_probe (pci, pci_id)); +} +static struct pci_driver ali5451_driver = { .name =KBUILD_MODNAME , .id_table = snd_ali_ids,
Signature · 1 line
2.31.1
PATCH 5/39 ALSA: als4000: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/als4000.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/als4000.c +8 -2
@@ -806,8 +806,8 @@ static void snd_card_als4000_free( struct snd_card *card )snd_als4000_free_gameport (acard); } -static int snd_card_als4000_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_card_als4000_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -930,6 +930,12 @@ static int snd_card_als4000_probe(struct pci_dev *pci,return 0 ; } +static int snd_card_als4000_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_card_als4000_probe (pci, pci_id)); +} +#ifdef CONFIG_PM_SLEEP static int snd_als4000_suspend (struct device *dev) {
Signature · 1 line
2.31.1
PATCH 6/39 ALSA: atiixp: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/atiixp.c | 10 ++++++++-- sound/pci/atiixp_modem.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
sound/pci/atiixp.c +8 -2
@@ -1572,8 +1572,8 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci) } -static int snd_atiixp_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_atiixp_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct atiixp *chip;
@@ -1623,6 +1623,12 @@ static int snd_atiixp_probe(struct pci_dev *pci,return 0 ; } +static int snd_atiixp_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_atiixp_probe (pci, pci_id)); +} +static struct pci_driver atiixp_driver = { .name =KBUILD_MODNAME , .id_table = snd_atiixp_ids,
sound/pci/atiixp_modem.c +8 -2
@@ -1201,8 +1201,8 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci) } -static int snd_atiixp_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_atiixp_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct atiixp_modem *chip;
@@ -1247,6 +1247,12 @@ static int snd_atiixp_probe(struct pci_dev *pci,return 0 ; } +static int snd_atiixp_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_atiixp_probe (pci, pci_id)); +} +static struct pci_driver atiixp_modem_driver = { .name =KBUILD_MODNAME , .id_table = snd_atiixp_ids,
Signature · 1 line
2.31.1
PATCH 7/39 ALSA: au88x0: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/au88x0/au88x0.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/au88x0/au88x0.c +7 -1
@@ -193,7 +193,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci)// constructor -- see "Constructor" sub-section static int -snd_vortex_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +__snd_vortex_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -310,6 +310,12 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)return 0 ; } +static int +snd_vortex_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_vortex_probe (pci, pci_id)); +} +// pci_driver definition static struct pci_driver vortex_driver = { .name =KBUILD_MODNAME ,
Signature · 1 line
2.31.1
PATCH 8/39 ALSA: azt3328: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/azt3328.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/azt3328.c +7 -1
@@ -2427,7 +2427,7 @@ snd_azf3328_create(struct snd_card *card, }static int -snd_azf3328_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +__snd_azf3328_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -2520,6 +2520,12 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)return 0 ; } +static int +snd_azf3328_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_azf3328_probe (pci, pci_id)); +} +#ifdef CONFIG_PM_SLEEP static inline void snd_azf3328_suspend_regs(const struct snd_azf3328 *chip,
Signature · 1 line
2.31.1
PATCH 9/39 ALSA: ca0106: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/ca0106/ca0106_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/ca0106/ca0106_main.c +8 -2
@@ -1725,8 +1725,8 @@ static int snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int channel) } -static int snd_ca0106_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_ca0106_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -1786,6 +1786,12 @@ static int snd_ca0106_probe(struct pci_dev *pci,return 0 ; } +static int snd_ca0106_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_ca0106_probe (pci, pci_id)); +} +#ifdef CONFIG_PM_SLEEP static int snd_ca0106_suspend (struct device *dev) {
Signature · 1 line
2.31.1
PATCH 10/39 ALSA: cs4281: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/cs4281.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/cs4281.c +8 -2
@@ -1827,8 +1827,8 @@ static void snd_cs4281_opl3_command(struct snd_opl3 *opl3, unsigned short cmd,spin_unlock_irqrestore (&opl3->reg_lock, flags); } -static int snd_cs4281_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_cs4281_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -1888,6 +1888,12 @@ static int snd_cs4281_probe(struct pci_dev *pci,return 0 ; } +static int snd_cs4281_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_cs4281_probe (pci, pci_id)); +} +/* * Power Management */
Signature · 1 line
2.31.1
PATCH 11/39 ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
--- sound/pci/cs5535audio/cs5535audio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/cs5535audio/cs5535audio.c +8 -2
@@ -281,8 +281,8 @@ static int snd_cs5535audio_create(struct snd_card *card,return 0 ; } -static int snd_cs5535audio_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_cs5535audio_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -331,6 +331,12 @@ static int snd_cs5535audio_probe(struct pci_dev *pci,return 0 ; } +static int snd_cs5535audio_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_cs5535audio_probe (pci, pci_id)); +} +static struct pci_driver cs5535audio_driver = { .name =KBUILD_MODNAME , .id_table = snd_cs5535audio_ids,
Signature · 1 line
2.31.1
PATCH 12/39 ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/emu10k1/emu10k1x.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/emu10k1/emu10k1x.c +8 -2
@@ -1491,8 +1491,8 @@ static int snd_emu10k1x_midi(struct emu10k1x *emu)return 0 ; } -static int snd_emu10k1x_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_emu10k1x_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -1554,6 +1554,12 @@ static int snd_emu10k1x_probe(struct pci_dev *pci,return 0 ; } +static int snd_emu10k1x_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_emu10k1x_probe (pci, pci_id)); +} +// PCI IDs static const struct pci_device_id snd_emu10k1x_ids[] = { {PCI_VDEVICE (CREATIVE ,0x0006 ),0 },/* Dell OEM version (EMU10K1) */
Signature · 1 line
2.31.1
PATCH 13/39 ALSA: ens137x: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/ens1370.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/ens1370.c +8 -2
@@ -2304,8 +2304,8 @@ static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -static int snd_audiopci_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_audiopci_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -2369,6 +2369,12 @@ static int snd_audiopci_probe(struct pci_dev *pci,return 0 ; } +static int snd_audiopci_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_audiopci_probe (pci, pci_id)); +} +static struct pci_driver ens137x_driver = { .name =KBUILD_MODNAME , .id_table = snd_audiopci_ids,
Signature · 1 line
2.31.1
PATCH 14/39 ALSA: es1938: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/es1938.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/es1938.c +8 -2
@@ -1716,8 +1716,8 @@ static int snd_es1938_mixer(struct es1938 *chip) } -static int snd_es1938_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_es1938_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -1796,6 +1796,12 @@ static int snd_es1938_probe(struct pci_dev *pci,return 0 ; } +static int snd_es1938_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_es1938_probe (pci, pci_id)); +} +static struct pci_driver es1938_driver = { .name =KBUILD_MODNAME , .id_table = snd_es1938_ids,
Signature · 1 line
2.31.1
PATCH 15/39 ALSA: es1968: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/es1968.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/es1968.c +8 -2
@@ -2741,8 +2741,8 @@ static int snd_es1968_create(struct snd_card *card,/* */ -static int snd_es1968_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_es1968_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -2848,6 +2848,12 @@ static int snd_es1968_probe(struct pci_dev *pci,return 0 ; } +static int snd_es1968_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_es1968_probe (pci, pci_id)); +} +static struct pci_driver es1968_driver = { .name =KBUILD_MODNAME , .id_table = snd_es1968_ids,
Signature · 1 line
2.31.1
PATCH 16/39 ALSA: fm801: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/fm801.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/fm801.c +8 -2
@@ -1268,8 +1268,8 @@ static int snd_fm801_create(struct snd_card *card,return 0 ; } -static int snd_card_fm801_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_card_fm801_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -1333,6 +1333,12 @@ static int snd_card_fm801_probe(struct pci_dev *pci,return 0 ; } +static int snd_card_fm801_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_card_fm801_probe (pci, pci_id)); +} +#ifdef CONFIG_PM_SLEEP static const unsigned char saved_regs[] = { FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC,
Signature · 1 line
2.31.1
PATCH 17/39 ALSA: ice1724: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/ice1712/ice1724.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/ice1712/ice1724.c +8 -2
@@ -2519,8 +2519,8 @@ static int snd_vt1724_create(struct snd_card *card,* */ -static int snd_vt1724_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_vt1724_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -2662,6 +2662,12 @@ static int snd_vt1724_probe(struct pci_dev *pci,return 0 ; } +static int snd_vt1724_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_vt1724_probe (pci, pci_id)); +} +#ifdef CONFIG_PM_SLEEP static int snd_vt1724_suspend (struct device *dev) {
Signature · 1 line
2.31.1
PATCH 18/39 ALSA: intel8x0: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/intel8x0.c | 10 ++++++++-- sound/pci/intel8x0m.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
sound/pci/intel8x0.c +8 -2
@@ -3109,8 +3109,8 @@ static int check_default_spdif_aclink(struct pci_dev *pci)return 0 ; } -static int snd_intel8x0_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_intel8x0_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct intel8x0 *chip;
@@ -3189,6 +3189,12 @@ static int snd_intel8x0_probe(struct pci_dev *pci,return 0 ; } +static int snd_intel8x0_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_intel8x0_probe (pci, pci_id)); +} +static struct pci_driver intel8x0_driver = { .name =KBUILD_MODNAME , .id_table = snd_intel8x0_ids,
sound/pci/intel8x0m.c +8 -2
@@ -1178,8 +1178,8 @@ static struct shortname_table { { 0 }, }; -static int snd_intel8x0m_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_intel8x0m_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct intel8x0m *chip;
@@ -1225,6 +1225,12 @@ static int snd_intel8x0m_probe(struct pci_dev *pci,return 0 ; } +static int snd_intel8x0m_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_intel8x0m_probe (pci, pci_id)); +} +static struct pci_driver intel8x0m_driver = { .name =KBUILD_MODNAME , .id_table = snd_intel8x0m_ids,
Signature · 1 line
2.31.1
PATCH 19/39 ALSA: korg1212: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/korg1212/korg1212.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/korg1212/korg1212.c +6 -2
@@ -2355,7 +2355,7 @@ snd_korg1212_probe(struct pci_dev *pci, err =snd_korg1212_create (card, pci);if (err <0 ) -return err; + goto error;strcpy (card->driver,"korg1212" );strcpy (card->shortname,"korg1212" );
@@ -2366,10 +2366,14 @@ snd_korg1212_probe(struct pci_dev *pci, err =snd_card_register (card);if (err <0 ) -return err; + goto error;pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }static struct pci_driver korg1212_driver = {
Signature · 1 line
2.31.1
PATCH 20/39 ALSA: maestro3: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/maestro3.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/maestro3.c +7 -1
@@ -2637,7 +2637,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,/* */ static int -snd_m3_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +__snd_m3_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -2702,6 +2702,12 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)return 0 ; } +static int +snd_m3_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_m3_probe (pci, pci_id)); +} +static struct pci_driver m3_driver = { .name =KBUILD_MODNAME , .id_table = snd_m3_ids,
Signature · 1 line
2.31.1
PATCH 21/39 ALSA: riptide: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/riptide/riptide.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/riptide/riptide.c +7 -1
@@ -2023,7 +2023,7 @@ static void snd_riptide_joystick_remove(struct pci_dev *pci)#endif static int -snd_card_riptide_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +__snd_card_riptide_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -2124,6 +2124,12 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)return 0 ; } +static int +snd_card_riptide_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_card_riptide_probe (pci, pci_id)); +} +static struct pci_driver driver = { .name =KBUILD_MODNAME , .id_table = snd_riptide_ids,
Signature · 1 line
2.31.1
PATCH 22/39 ALSA: rme32: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/rme32.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/rme32.c +7 -1
@@ -1875,7 +1875,7 @@ static void snd_rme32_card_free(struct snd_card *card) }static int -snd_rme32_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +__snd_rme32_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) {static int dev;struct rme32 *rme32;
@@ -1927,6 +1927,12 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)return 0 ; } +static int +snd_rme32_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_rme32_probe (pci, pci_id)); +} +static struct pci_driver rme32_driver = { .name =KBUILD_MODNAME , .id_table = snd_rme32_ids,
Signature · 1 line
2.31.1
PATCH 23/39 ALSA: rme96: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/rme96.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/rme96.c +8 -2
@@ -2430,8 +2430,8 @@ static void snd_rme96_card_free(struct snd_card *card) }static int -snd_rme96_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +__snd_rme96_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct rme96 *rme96;
@@ -2498,6 +2498,12 @@ snd_rme96_probe(struct pci_dev *pci,return 0 ; } +static int snd_rme96_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_rme96_probe (pci, pci_id)); +} +static struct pci_driver rme96_driver = { .name =KBUILD_MODNAME , .id_table = snd_rme96_ids,
Signature · 1 line
2.31.1
PATCH 24/39 ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/sonicvibes.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/sonicvibes.c +8 -2
@@ -1387,8 +1387,8 @@ static int snd_sonicvibes_midi(struct sonicvibes *sonic,return 0 ; } -static int snd_sonic_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_sonic_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -1459,6 +1459,12 @@ static int snd_sonic_probe(struct pci_dev *pci,return 0 ; } +static int snd_sonic_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_sonic_probe (pci, pci_id)); +} +static struct pci_driver sonicvibes_driver = { .name =KBUILD_MODNAME , .id_table = snd_sonic_ids,
Signature · 1 line
2.31.1
PATCH 25/39 ALSA: via82xx: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/via82xx.c | 10 ++++++++-- sound/pci/via82xx_modem.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
sound/pci/via82xx.c +8 -2
@@ -2458,8 +2458,8 @@ static int check_dxs_list(struct pci_dev *pci, int revision)return VIA_DXS_48K ; }; -static int snd_via82xx_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_via82xx_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct via82xx *chip;
@@ -2569,6 +2569,12 @@ static int snd_via82xx_probe(struct pci_dev *pci,return 0 ; } +static int snd_via82xx_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_via82xx_probe (pci, pci_id)); +} +static struct pci_driver via82xx_driver = { .name =KBUILD_MODNAME , .id_table = snd_via82xx_ids,
sound/pci/via82xx_modem.c +8 -2
@@ -1103,8 +1103,8 @@ static int snd_via82xx_create(struct snd_card *card, } -static int snd_via82xx_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_via82xx_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct via82xx_modem *chip;
@@ -1157,6 +1157,12 @@ static int snd_via82xx_probe(struct pci_dev *pci,return 0 ; } +static int snd_via82xx_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_via82xx_probe (pci, pci_id)); +} +static struct pci_driver via82xx_modem_driver = { .name =KBUILD_MODNAME , .id_table = snd_via82xx_modem_ids,
Signature · 1 line
2.31.1
PATCH 26/39 ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/x86/intel_hdmi_audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/x86/intel_hdmi_audio.c +6 -1
@@ -1652,7 +1652,7 @@ static void hdmi_lpe_audio_free(struct snd_card *card)* This function is called when the i915 driver creates the * hdmi-lpe-audio platform device. */ -static int hdmi_lpe_audio_probe (struct platform_device *pdev) +static int __hdmi_lpe_audio_probe (struct platform_device *pdev) {struct snd_card *card;struct snd_intelhad_card *card_ctx;
@@ -1815,6 +1815,11 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)return 0 ; } +static int hdmi_lpe_audio_probe (struct platform_device *pdev) +{ +return snd_card_free_on_error (&pdev->dev,__hdmi_lpe_audio_probe (pdev)); +} +static const struct dev_pm_ops hdmi_lpe_audio_pm = {SET_SYSTEM_SLEEP_PM_OPS (hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) };
Signature · 1 line
2.31.1
kernel test robot
build botRe: [PATCH 26/39] ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error
I love your patch! Yet something to improve:
Hi Takashi,
I love your patch! Yet something to improve:
[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on v5.18-rc2 next-20220412]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Takashi-Iwai/ALSA-Fix-error-handling-order-at-probe-error/20220412-183941 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next config: i386-randconfig-a016-20220411 (https://download.01.org/0day-ci/archive/20220413/[email protected]/config) compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/9e76730fee819f96c44f07e9a100c907457aed8b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Takashi-Iwai/ALSA-Fix-error-handling-order-at-probe-error/20220412-183941 git checkout 9e76730fee819f96c44f07e9a100c907457aed8b
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
sound/x86/intel_hdmi_audio.c: In function 'hdmi_lpe_audio_probe':
>> sound/x86/intel_hdmi_audio.c:1820:16: error: implicit declaration of function 'snd_card_free_on_error'; did you mean 'snd_ctl_free_one'? [-Werror=implicit-function-declaration]
1820 | return snd_card_free_on_error(&pdev->dev, __hdmi_lpe_audio_probe(pdev));
| ^~~~~~~~~~~~~~~~~~~~~~
| snd_ctl_free_onecc1: some warnings being treated as errors
vim +1820 sound/x86/intel_hdmi_audio.c
1817
1818 static int hdmi_lpe_audio_probe(struct platform_device *pdev)
1819 {
> 1820 return snd_card_free_on_error(&pdev->dev, __hdmi_lpe_audio_probe(pdev));
1821 }
1822
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
PATCH 27/39 ALSA: sis7019: Fix the missing error handling
In reply to Takashi IwaiThe 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.
--- sound/pci/sis7019.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
sound/pci/sis7019.c +10 -4
@@ -1331,8 +1331,8 @@ static int sis_chip_create(struct snd_card *card,return 0 ; } -static int snd_sis7019_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_sis7019_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {struct snd_card *card;struct sis7019 *sis;
@@ -1352,8 +1352,8 @@ static int snd_sis7019_probe(struct pci_dev *pci,if (!codecs) codecs =SIS_PRIMARY_CODEC_PRESENT ; - rc =snd_card_new (&pci->dev, index, id,THIS_MODULE , -sizeof (*sis), &card); + rc =snd_devm_card_new (&pci->dev, index, id,THIS_MODULE , +sizeof (*sis), &card);if (rc <0 )return rc;
@@ -1386,6 +1386,12 @@ static int snd_sis7019_probe(struct pci_dev *pci,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 = { .name =KBUILD_MODNAME , .id_table = snd_sis7019_ids,
Signature · 1 line
2.31.1
PATCH 28/39 ALSA: bt87x: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/bt87x.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/bt87x.c +8 -2
@@ -805,8 +805,8 @@ static int snd_bt87x_detect_card(struct pci_dev *pci)return SND_BT87X_BOARD_UNKNOWN ; } -static int snd_bt87x_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __snd_bt87x_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -889,6 +889,12 @@ static int snd_bt87x_probe(struct pci_dev *pci,return 0 ; } +static int snd_bt87x_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__snd_bt87x_probe (pci, pci_id)); +} +/* default entries for all Bt87x cards - it's not exported */ /* driver_data is set to 0 to call detection */ static const struct pci_device_id snd_bt87x_default_ids[] = {
Signature · 1 line
2.31.1
PATCH 29/39 ALSA: lola: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/lola/lola.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/pci/lola/lola.c +8 -2
@@ -637,8 +637,8 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev)return 0 ; } -static int lola_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int __lola_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev;struct snd_card *card;
@@ -687,6 +687,12 @@ static int lola_probe(struct pci_dev *pci,return 0 ; } +static int lola_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) +{ +return snd_card_free_on_error (&pci->dev,__lola_probe (pci, pci_id)); +} +/* PCI IDs */ static const struct pci_device_id lola_ids[] = { {PCI_VDEVICE (DIGIGRAM ,0x0001 ) },
Signature · 1 line
2.31.1
PATCH 30/39 ALSA: als300: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/als300.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/als300.c +6 -2
@@ -708,7 +708,7 @@ static int snd_als300_probe(struct pci_dev *pci, err =snd_als300_create (card, pci, chip_type);if (err <0 ) -return err; + goto error;strcpy (card->driver,"ALS300" );if (chip->chip_type ==DEVICE_ALS300_PLUS )
@@ -723,11 +723,15 @@ static int snd_als300_probe(struct pci_dev *pci, err =snd_card_register (card);if (err <0 ) -return err; + goto error;pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }static struct pci_driver als300_driver = {
Signature · 1 line
2.31.1
PATCH 31/39 ALSA: aw2: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/aw2/aw2-alsa.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/aw2/aw2-alsa.c +6 -2
@@ -275,7 +275,7 @@ static int snd_aw2_probe(struct pci_dev *pci,/* (3) Create main component */ err =snd_aw2_create (card, pci);if (err <0 ) -return err; + goto error;/* initialize mutex */ mutex_init (&chip->mtx);
@@ -294,13 +294,17 @@ static int snd_aw2_probe(struct pci_dev *pci,/* (6) Register card instance */ err =snd_card_register (card);if (err <0 ) -return err; + goto error;/* (7) Set PCI driver data */ pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }/* open callback */
Signature · 1 line
2.31.1
PATCH 32/39 ALSA: cmipci: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/cmipci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/cmipci.c +6 -2
@@ -3247,15 +3247,19 @@ static int snd_cmipci_probe(struct pci_dev *pci, err =snd_cmipci_create (card, pci, dev);if (err <0 ) -return err; + goto error; err =snd_card_register (card);if (err <0 ) -return err; + goto error;pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.31.1
PATCH 33/39 ALSA: lx6464es: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/lx6464es/lx6464es.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/lx6464es/lx6464es.c +6 -2
@@ -1019,7 +1019,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci, err =snd_lx6464es_create (card, pci);if (err <0 ) {dev_err (card->dev,"error during snd_lx6464es_create\n" ); -return err; + goto error; }strcpy (card->driver,"LX6464ES" );
@@ -1036,12 +1036,16 @@ static int snd_lx6464es_probe(struct pci_dev *pci, err =snd_card_register (card);if (err <0 ) -return err; + goto error;dev_dbg (chip->card->dev,"initialization successful\n" );pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }static struct pci_driver lx6464es_driver = {
Signature · 1 line
2.31.1
PATCH 34/39 ALSA: oxygen: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() on the error from the probe callback using a new helper function.
--- sound/pci/oxygen/oxygen_lib.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
sound/pci/oxygen/oxygen_lib.c +11 -1
@@ -576,7 +576,7 @@ static void oxygen_card_free(struct snd_card *card)mutex_destroy (&chip->mutex); } -int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, +static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id, struct module *owner, const struct pci_device_id *ids, int (*get_model)(struct oxygen *chip,
@@ -701,6 +701,16 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,pci_set_drvdata (pci, card);return 0 ; } + +int oxygen_pci_probe (struct pci_dev *pci,int index,char *id, +struct module *owner, +const struct pci_device_id *ids, +int (*get_model)(struct oxygen *chip, +const struct pci_device_id *id)) +{ +return snd_card_free_on_error (&pci->dev, +__oxygen_pci_probe (pci, index, id, owner, ids, get_model)); +}EXPORT_SYMBOL (oxygen_pci_probe);#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.31.1
PATCH 35/39 ALSA: hdsp: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/rme9652/hdsp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/rme9652/hdsp.c +6 -2
@@ -5444,17 +5444,21 @@ static int snd_hdsp_probe(struct pci_dev *pci, hdsp->pci = pci; err =snd_hdsp_create (card, hdsp);if (err) -return err; + goto error;strcpy (card->shortname,"Hammerfall DSP" );sprintf (card->longname,"%s at 0x%lx, irq %d" , hdsp->card_name, hdsp->port, hdsp->irq); err =snd_card_register (card);if (err) -return err; + goto error;pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }static struct pci_driver hdsp_driver = {
Signature · 1 line
2.31.1
PATCH 36/39 ALSA: hdspm: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/rme9652/hdspm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/rme9652/hdspm.c +6 -2
@@ -6895,7 +6895,7 @@ static int snd_hdspm_probe(struct pci_dev *pci, err =snd_hdspm_create (card, hdspm);if (err <0 ) -return err; + goto error;if (hdspm->io_type != MADIface) { snprintf(card->shortname, sizeof(card->shortname), "%s_%x",
@@ -6914,12 +6914,16 @@ static int snd_hdspm_probe(struct pci_dev *pci, err =snd_card_register (card);if (err <0 ) -return err; + goto error;pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }static struct pci_driver hdspm_driver = {
Signature · 1 line
2.31.1
PATCH 37/39 ALSA: rme9652: Fix the missing snd_card_free() call at probe error
In reply to Takashi IwaiThe previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free().
This patch fixes it by calling snd_card_free() manually on the error from the probe callback.
--- sound/pci/rme9652/rme9652.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/rme9652/rme9652.c +6 -2
@@ -2572,7 +2572,7 @@ static int snd_rme9652_probe(struct pci_dev *pci, rme9652->pci = pci; err =snd_rme9652_create (card, rme9652, precise_ptr[dev]);if (err) -return err; + goto error;strcpy (card->shortname, rme9652->card_name);
@@ -2580,10 +2580,14 @@ static int snd_rme9652_probe(struct pci_dev *pci, card->shortname, rme9652->port, rme9652->irq); err =snd_card_register (card);if (err) -return err; + goto error;pci_set_drvdata (pci, card); dev++;return 0 ; + + error: +snd_card_free (card); +return err; }static struct pci_driver rme9652_driver = {
Signature · 1 line
2.31.1
PATCH 38/39 ALSA: mtpav: Don't call card private_free at probe error path
In reply to Takashi IwaiThe card destructor of nm256 driver does merely stopping the running timer, and it's superfluous for the probe error handling. Moreover, calling this via the previous devres change would lead to another problem due to the reverse call order.
This patch moves the setup of the private_free callback after the card registration, so that it can be used only after fully set up.
--- sound/drivers/mtpav.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/drivers/mtpav.c +2 -2
@@ -693,8 +693,6 @@ static int snd_mtpav_probe(struct platform_device *dev) mtp_card->outmidihwport =0xffffffff ;timer_setup (&mtp_card->timer, snd_mtpav_output_timer,0 ); - card->private_free = snd_mtpav_free; - err =snd_mtpav_get_RAWMIDI (mtp_card);if (err <0 )return err;
@@ -716,6 +714,8 @@ static int snd_mtpav_probe(struct platform_device *dev)if (err <0 )return err; + card->private_free = snd_mtpav_free; +platform_set_drvdata (dev, card);printk (KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n" , irq, port);return 0 ;
Signature · 1 line
2.31.1
PATCH 39/39 ALSA: nm256: Don't call card private_free at probe error path
In reply to Takashi IwaiThe card destructor of nm256 driver does merely stopping the running streams, and it's superfluous for the probe error handling. Moreover, calling this via the previous devres change would lead to another problem due to the reverse call order.
This patch moves the setup of the private_free callback after the card registration, so that it can be used only after fully set up.
--- sound/pci/nm256/nm256.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/nm256/nm256.c +1 -1
@@ -1573,7 +1573,6 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci) chip->coeffs_current =0 ;snd_nm256_init_chip (chip); - card->private_free = snd_nm256_free;// pci_set_master(pci); /* needed? */ return 0 ;
@@ -1680,6 +1679,7 @@ static int snd_nm256_probe(struct pci_dev *pci, err =snd_card_register (card);if (err <0 )return err; + card->private_free = snd_nm256_free;pci_set_drvdata (pci, card);return 0 ;
Signature · 1 line
2.31.1