ALSA: Use auto-cleanup for probe card error handling
Subsystems (5)
v2 cover ALSA: Use auto-cleanup for probe card error handling
Hi,
here is a revised series of trivial changes as a cleanup.
So far, many sound drivers use the manual call of snd_card_free_on_error() helper in order to deal with the errors at probe time. This can be gracefully done via auto-cleanup, and here are the conversions.
In this version, the new __free(snd_card_free) is used instead of __free(snd_card_unref).
Only code refactoring, and no functional changes are expected.
Takashi
===
Takashi Iwai (32):
ALSA: galaxy: Use auto-cleanup for probe card error handling
ALSA: sc6000: Use auto-cleanup for probe card error handling
ALSA: ad1889: Use auto-cleanup for probe card error handling
ALSA: ali5451: Use auto-cleanup for probe card error handling
ALSA: als4000: Use auto-cleanup for probe card error handling
ALSA: atiixp: Use auto-cleanup for probe card error handling
ALSA: au88x0: Use auto-cleanup for probe card error handling
ALSA: azt3328: Use auto-cleanup for probe card error handling
ALSA: bt87x: Use auto-cleanup for probe card error handling
ALSA: ca0106: Use auto-cleanup for probe card error handling
ALSA: cs4281: Use auto-cleanup for probe card error handling
ALSA: cs5535audio: Use auto-cleanup for probe card error handling
ALSA: echoaudio: Use auto-cleanup for probe card error handling
ALSA: emu10k1x: Use auto-cleanup for probe card error handling
ALSA: ens137x: Use auto-cleanup for probe card error handling
ALSA: es1938: Use auto-cleanup for probe card error handling
ALSA: es1968: Use auto-cleanup for probe card error handling
ALSA: fm801: Use auto-cleanup for probe card error handling
ALSA: ice1724: Use auto-cleanup for probe card error handling
ALSA: intel8x0: Use auto-cleanup for probe card error handling
ALSA: lola: Use auto-cleanup for probe card error handling
ALSA: maestro3: Use auto-cleanup for probe card error handling
ALSA: oxygen: Use auto-cleanup for probe card error handling
ALSA: riptide: Use auto-cleanup for probe card error handling
ALSA: rme32: Use auto-cleanup for probe card error handling
ALSA: rm96: Use auto-cleanup for probe card error handling
ALSA: sis7019: Use auto-cleanup for probe card error handling
ALSA: sonicbibes: Use auto-cleanup for probe card error handling
ALSA: via82xx: Use auto-cleanup for probe card error handling
ALSA: ymfpci: Use auto-cleanup for probe card error handling
ALSA: intel-hdmi-audio: Use auto-cleanup for probe card error handling
ALSA: Drop unused snd_card_free_on_error()
include/sound/core.h | 1 - sound/core/init.c | 36 ++++++----------------------- sound/isa/galaxy/galaxy.c | 10 +++----- sound/isa/sc6000.c | 10 +++----- sound/pci/ad1889.c | 13 ++++------- sound/pci/ali5451/ali5451.c | 13 ++++------- sound/pci/als4000.c | 13 ++++------- sound/pci/atiixp.c | 13 ++++------- sound/pci/atiixp_modem.c | 13 ++++------- sound/pci/au88x0/au88x0.c | 11 +++------ sound/pci/azt3328.c | 11 +++------ sound/pci/bt87x.c | 13 ++++------- sound/pci/ca0106/ca0106_main.c | 11 +++------ sound/pci/cs4281.c | 13 ++++------- sound/pci/cs5535audio/cs5535audio.c | 13 ++++------- sound/pci/echoaudio/echoaudio.c | 14 ++++------- sound/pci/emu10k1/emu10k1x.c | 13 ++++------- sound/pci/ens1370.c | 13 ++++------- sound/pci/es1938.c | 13 ++++------- sound/pci/es1968.c | 13 ++++------- sound/pci/fm801.c | 13 ++++------- sound/pci/ice1712/ice1724.c | 13 ++++------- sound/pci/intel8x0.c | 14 ++++------- sound/pci/intel8x0m.c | 13 ++++------- sound/pci/lola/lola.c | 13 ++++------- sound/pci/maestro3.c | 11 +++------ sound/pci/oxygen/oxygen_lib.c | 15 +++--------- sound/pci/riptide/riptide.c | 11 +++------ sound/pci/rme32.c | 11 +++------ sound/pci/rme96.c | 13 ++++------- sound/pci/sis7019.c | 13 ++++------- sound/pci/sonicvibes.c | 13 ++++------- sound/pci/via82xx.c | 13 ++++------- sound/pci/via82xx_modem.c | 13 ++++------- sound/pci/ymfpci/ymfpci.c | 13 ++++------- sound/x86/intel_hdmi_audio.c | 10 +++----- 36 files changed, 134 insertions(+), 328 deletions(-)
Signature · 1 line
2.55.0
PATCH v2 1/32 ALSA: galaxy: Use auto-cleanup for probe card error handling
Instead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/isa/galaxy/galaxy.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
sound/isa/galaxy/galaxy.c +3 -7
@@ -478,11 +478,11 @@ 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; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;u8 type;int err;
@@ -595,14 +595,10 @@ static int __snd_galaxy_probe(struct device *dev, unsigned int n)return err;dev_set_drvdata (dev, card); + card =NULL ;/* probe succeeded, don't release as error */ 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.55.0
PATCH v2 2/32 ALSA: sc6000: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/isa/sc6000.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
sound/isa/sc6000.c +3 -7
@@ -572,14 +572,14 @@ static void snd_sc6000_free(struct snd_card *card)sc6000_setup_board (card->dev, sc6000->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 };int err;int xirq = irq[dev];int xdma = dma[dev]; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_sc6000 *sc6000;struct snd_wss *chip;struct snd_opl3 *opl3;
@@ -696,14 +696,10 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)return err;dev_set_drvdata (devptr, card); + card =NULL ;/* probe succeeded, don't release as error */ 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)); -} -#ifdef CONFIG_PM static int snd_sc6000_suspend (struct device *devptr,unsigned int dev,pm_message_t state)
Signature · 1 line
2.55.0
PATCH v2 3/32 ALSA: ad1889: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/ad1889.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/ad1889.c +4 -9
@@ -837,12 +837,12 @@ 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; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_ad1889 *chip;/* (1) */
@@ -892,17 +892,12 @@ __snd_ad1889_probe(struct pci_dev *pci,/* (7) */ pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ devno++;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.55.0
PATCH v2 4/32 ALSA: ali5451: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/ali5451/ali5451.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/ali5451/ali5451.c +4 -9
@@ -2086,10 +2086,10 @@ 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_card *card __free(snd_card_free) = NULL;struct snd_ali *codec;int err;
@@ -2129,15 +2129,10 @@ static int __snd_ali_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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.55.0
PATCH v2 5/32 ALSA: als4000: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/als4000.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/als4000.c +4 -9
@@ -798,11 +798,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_card_als4000 *acard;unsigned long iobase;struct snd_sb *chip;
@@ -918,16 +918,11 @@ static int __snd_card_als4000_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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)); -} -static int snd_als4000_suspend (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);
Signature · 1 line
2.55.0
PATCH v2 6/32 ALSA: atiixp: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/atiixp.c | 13 ++++--------- sound/pci/atiixp_modem.c | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-)
sound/pci/atiixp.c +4 -9
@@ -1550,10 +1550,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct atiixp *chip;int err;
@@ -1598,15 +1598,10 @@ static int __snd_atiixp_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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 +4 -9
@@ -1182,10 +1182,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct atiixp_modem *chip;int err;
@@ -1225,15 +1225,10 @@ static int __snd_atiixp_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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.55.0
PATCH v2 7/32 ALSA: au88x0: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/au88x0/au88x0.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/au88x0/au88x0.c +3 -8
@@ -192,10 +192,10 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;vortex_t *chip;int err;
@@ -303,18 +303,13 @@ __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)return err;// (7) pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;vortex_connect_default (chip,1 );vortex_enable_int (chip);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.55.0
PATCH v2 8/32 ALSA: azt3328: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/azt3328.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/azt3328.c +3 -8
@@ -2403,10 +2403,10 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_azf3328 *chip;struct snd_opl3 *opl3;int err;
@@ -2492,16 +2492,11 @@ __snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)snd_azf3328_gameport (chip, dev);pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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)); -} -static inline void snd_azf3328_suspend_regs (const struct snd_azf3328 *chip,unsigned long io_addr,unsigned count,u32 *saved_regs)
Signature · 1 line
2.55.0
PATCH v2 9/32 ALSA: bt87x: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/bt87x.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/bt87x.c +4 -9
@@ -798,11 +798,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_bt87x *chip;int err;enum snd_bt87x_boardid boardid;
@@ -878,16 +878,11 @@ static int __snd_bt87x_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ ++dev;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.55.0
PATCH v2 10/32 ALSA: ca0106: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/ca0106/ca0106_main.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/ca0106/ca0106_main.c +3 -8
@@ -1710,11 +1710,11 @@ static int snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int channel) } -static int __snd_ca0106_probe (struct pci_dev *pci, +static int snd_ca0106_probe (struct pci_dev *pci,const struct pci_device_id *pci_id) {static int dev; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_ca0106 *chip;int i, err;
@@ -1767,16 +1767,11 @@ static int __snd_ca0106_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 11/32 ALSA: cs4281: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/cs4281.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/cs4281.c +4 -9
@@ -1811,11 +1811,11 @@ static void snd_cs4281_opl3_command(struct snd_opl3 *opl3, unsigned short cmd,udelay (30 ); } -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; + struct snd_card *card __free(snd_card_free) = NULL;struct cs4281 *chip;struct snd_opl3 *opl3;int err;
@@ -1868,16 +1868,11 @@ static int __snd_cs4281_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 12/32 ALSA: cs5535audio: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/cs5535audio/cs5535audio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/cs5535audio/cs5535audio.c +4 -9
@@ -283,11 +283,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct cs5535audio *cs5535au;int err;
@@ -329,16 +329,11 @@ static int __snd_cs5535audio_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 13/32 ALSA: echoaudio: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/echoaudio/echoaudio.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
sound/pci/echoaudio/echoaudio.c +4 -10
@@ -1934,11 +1934,11 @@ static int snd_echo_create(struct snd_card *card, }/* constructor */ -static int __snd_echo_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int snd_echo_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;struct echoaudio *chip;char *dsp;int err;
@@ -2097,17 +2097,11 @@ static int __snd_echo_probe(struct pci_dev *pci,dev_info (card->dev,"Card registered: %s\n" , card->longname);pci_set_drvdata (pci, chip); + card =NULL ;/* probe succeeded, don't release as error */ dev++;return 0 ; } -static int snd_echo_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) -{ -return snd_card_free_on_error (&pci->dev,__snd_echo_probe (pci, pci_id)); -} - -static int snd_echo_suspend (struct device *dev) {struct echoaudio *chip =dev_get_drvdata (dev);
Signature · 1 line
2.55.0
PATCH v2 14/32 ALSA: emu10k1x: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/emu10k1/emu10k1x.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/emu10k1/emu10k1x.c +4 -9
@@ -1447,11 +1447,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct emu10k1x *chip;int err;
@@ -1506,16 +1506,11 @@ static int __snd_emu10k1x_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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 ) },/* Dell OEM version (EMU10K1) */
Signature · 1 line
2.55.0
PATCH v2 15/32 ALSA: ens137x: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/ens1370.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/ens1370.c +4 -9
@@ -2267,11 +2267,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct ensoniq *ensoniq;int err;
@@ -2328,16 +2328,11 @@ static int __snd_audiopci_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 16/32 ALSA: es1938: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/es1938.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/es1938.c +4 -9
@@ -1683,11 +1683,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct es1938 *chip;struct snd_opl3 *opl3;int idx, err;
@@ -1759,16 +1759,11 @@ static int __snd_es1938_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 17/32 ALSA: es1968: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/es1968.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/es1968.c +4 -9
@@ -2692,11 +2692,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct es1968 *chip;unsigned int i;int err;
@@ -2795,16 +2795,11 @@ static int __snd_es1968_probe(struct pci_dev *pci,if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 18/32 ALSA: fm801: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/fm801.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/fm801.c +4 -9
@@ -1264,11 +1264,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct fm801 *chip;struct snd_opl3 *opl3;int err;
@@ -1325,16 +1325,11 @@ static int __snd_card_fm801_probe(struct pci_dev *pci,if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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)); -} -static const unsigned char saved_regs[] = {FM801_PCM_VOL ,FM801_I2S_VOL ,FM801_FM_VOL ,FM801_REC_SRC ,FM801_PLY_CTRL ,FM801_PLY_COUNT ,FM801_PLY_BUF1 ,FM801_PLY_BUF2 ,
Signature · 1 line
2.55.0
PATCH v2 19/32 ALSA: ice1724: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/ice1712/ice1724.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/ice1712/ice1724.c +4 -9
@@ -2524,11 +2524,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_ice1712 *ice;int pcm_dev =0 , err;const struct snd_ice1712_card_info *c;
@@ -2663,16 +2663,11 @@ static int __snd_vt1724_probe(struct pci_dev *pci,if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 20/32 ALSA: intel8x0: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/intel8x0.c | 14 +++++--------- sound/pci/intel8x0m.c | 13 ++++--------- 2 files changed, 9 insertions(+), 18 deletions(-)
sound/pci/intel8x0.c +5 -9
@@ -3167,10 +3167,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct intel8x0 *chip;int err;struct shortname_table *name;
@@ -3244,13 +3244,9 @@ static int __snd_intel8x0_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); -return 0 ; -} + card =NULL ;/* probe succeeded, don't release as error */ -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)); +return 0 ; }static struct pci_driver intel8x0_driver = {
sound/pci/intel8x0m.c +4 -9
@@ -1218,10 +1218,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct intel8x0m *chip;int err;struct shortname_table *name;
@@ -1262,15 +1262,10 @@ static int __snd_intel8x0m_probe(struct pci_dev *pci,if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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.55.0
PATCH v2 21/32 ALSA: lola: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/lola/lola.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/lola/lola.c +4 -9
@@ -641,11 +641,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct lola *chip;int err;
@@ -687,16 +687,11 @@ static int __lola_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 22/32 ALSA: maestro3: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/maestro3.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/maestro3.c +3 -8
@@ -2629,10 +2629,10 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_m3 *chip;int err;
@@ -2690,16 +2690,11 @@ __snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)#endif pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 23/32 ALSA: oxygen: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/oxygen/oxygen_lib.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
sound/pci/oxygen/oxygen_lib.c +3 -12
@@ -572,7 +572,7 @@ static void oxygen_card_free(struct snd_card *card)mutex_destroy (&chip->mutex); } -static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id, +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,
@@ -580,7 +580,7 @@ static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id, ) ) { -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;struct oxygen *chip;const struct pci_device_id *pci_id;int err;
@@ -695,18 +695,9 @@ static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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);static int oxygen_pci_suspend (struct device *dev)
Signature · 1 line
2.55.0
PATCH v2 24/32 ALSA: riptide: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/riptide/riptide.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/riptide/riptide.c +3 -8
@@ -2020,10 +2020,10 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct snd_riptide *chip;unsigned short val;int err;
@@ -2117,16 +2117,11 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_idif (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 25/32 ALSA: rme32: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/rme32.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/rme32.c +3 -8
@@ -1810,11 +1810,11 @@ 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; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;int err;if (dev >=SNDRV_CARDS ) {
@@ -1858,16 +1858,11 @@ __snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 26/32 ALSA: rm96: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/rme96.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/rme96.c +4 -9
@@ -2356,12 +2356,12 @@ 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; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;int err;u8 val;
@@ -2420,16 +2420,11 @@ __snd_rme96_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 27/32 ALSA: sis7019: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/sis7019.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/sis7019.c +4 -9
@@ -1309,10 +1309,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct sis7019 *sis;int rc;
@@ -1361,15 +1361,10 @@ static int __snd_sis7019_probe(struct pci_dev *pci,return rc;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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.55.0
PATCH v2 28/32 ALSA: sonicbibes: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/sonicvibes.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/sonicvibes.c +4 -9
@@ -1362,11 +1362,11 @@ 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; + struct snd_card *card __free(snd_card_free) = NULL;struct sonicvibes *sonic;struct snd_rawmidi *midi_uart;struct snd_opl3 *opl3;
@@ -1430,16 +1430,11 @@ static int __snd_sonic_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;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.55.0
PATCH v2 29/32 ALSA: via82xx: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/via82xx.c | 13 ++++--------- sound/pci/via82xx_modem.c | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-)
sound/pci/via82xx.c +4 -9
@@ -2435,10 +2435,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct via82xx *chip;int chip_type =0 , card_type;unsigned int i;
@@ -2543,15 +2543,10 @@ static int __snd_via82xx_probe(struct pci_dev *pci,if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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 +4 -9
@@ -1088,10 +1088,10 @@ 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 snd_card *card __free(snd_card_free) = NULL;struct via82xx_modem *chip;int chip_type =0 , card_type;unsigned int i;
@@ -1139,15 +1139,10 @@ static int __snd_via82xx_probe(struct pci_dev *pci,if (err <0 )return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ 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.55.0
PATCH v2 30/32 ALSA: ymfpci: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/pci/ymfpci/ymfpci.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/pci/ymfpci/ymfpci.c +4 -9
@@ -152,11 +152,11 @@ static inline int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev, ivoid snd_ymfpci_free_gameport (struct snd_ymfpci *chip) { }#endif /* SUPPORT_JOYSTICK */ -static int __snd_card_ymfpci_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) +static int snd_card_ymfpci_probe (struct pci_dev *pci, +const struct pci_device_id *pci_id) {static int dev; -struct snd_card *card; + struct snd_card *card __free(snd_card_free) = NULL;struct resource *fm_res =NULL ;struct resource *mpu_res =NULL ;struct snd_ymfpci *chip;
@@ -344,16 +344,11 @@ static int __snd_card_ymfpci_probe(struct pci_dev *pci,return err;pci_set_drvdata (pci, card); + card =NULL ;/* probe succeeded, don't release as error */ dev++;return 0 ; } -static int snd_card_ymfpci_probe (struct pci_dev *pci, -const struct pci_device_id *pci_id) -{ -return snd_card_free_on_error (&pci->dev,__snd_card_ymfpci_probe (pci, pci_id)); -} -static struct pci_driver ymfpci_driver = { .name =KBUILD_MODNAME , .id_table = snd_ymfpci_ids,
Signature · 1 line
2.55.0
PATCH v2 31/32 ALSA: intel-hdmi-audio: Use auto-cleanup for probe card error handling
In reply to Takashi IwaiInstead of the manual call of snd_card_free_on_error(), use the auto-cleanup feature.
Merely a code cleanup, and no functional changes.
--- sound/x86/intel_hdmi_audio.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
sound/x86/intel_hdmi_audio.c +3 -7
@@ -1634,9 +1634,9 @@ 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_card *card __free(snd_card_free) = NULL;struct snd_intelhad_card *card_ctx;struct snd_intelhad *ctx;struct snd_pcm *pcm;
@@ -1797,14 +1797,10 @@ static int __hdmi_lpe_audio_probe(struct platform_device *pdev)schedule_work (&ctx->hdmi_audio_wq); } + card =NULL ;/* probe succeeded, don't release as error */ 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 = {SYSTEM_SLEEP_PM_OPS (hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) };
Signature · 1 line
2.55.0
PATCH v2 32/32 ALSA: Drop unused snd_card_free_on_error()
In reply to Takashi IwaiNow that all users of snd_card_free_on_error() are gone by refactoring with auto-cleanup, let's drop the superfluous function.
Also, update the documentation for reflecting the recommended error handling procedure, too.
--- include/sound/core.h | 1 - sound/core/init.c | 36 +++++++----------------------------- 2 files changed, 7 insertions(+), 30 deletions(-)
include/sound/core.h +0 -1
@@ -314,7 +314,6 @@ void snd_card_disconnect(struct snd_card *card);void snd_card_disconnect_sync (struct snd_card *card);void snd_card_free (struct snd_card *card);void snd_card_free_when_closed (struct snd_card *card); -int snd_card_free_on_error (struct device *dev,int ret);void snd_card_set_id (struct snd_card *card,const char *id);int snd_card_register (struct snd_card *card);int snd_card_info_init (void );
sound/core/init.c +7 -29
@@ -216,11 +216,13 @@ static void __snd_card_release(struct device *dev, void *data)* is added automatically. In that way, the resource disconnection is assured * at first, then released in the expected order. * -* If an error happens at the probe before snd_card_register() is called and -* there have been other devres resources, you'd need to free the card manually -* via snd_card_free() call in the error; otherwise it may lead to UAF due to -* devres call orders. You can use snd_card_free_on_error() helper for -* handling it more easily. +* Caveat: if an error happens at the probe before snd_card_register() is +* called and there have been other devres resources that are referred at the +* card-level destructor call, you'd still need to free the card manually; +* otherwise it may lead to UAF due to devres call orders. Instead of a manual +* snd_card_free() call, you can use the automatic clean-up for the card +* pointer via __free(snd_card_free), too. In this case, don't forget to do +* NULL-clear the card pointer before the successful return! * * Return: zero if successful, or a negative error code */
@@ -250,30 +252,6 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid, }EXPORT_SYMBOL_GPL (snd_devm_card_new); -/** -* snd_card_free_on_error - a small helper for handling devm probe errors -* @dev: the managed device object -* @ret: the return code from the probe callback -* -* This function handles the explicit snd_card_free() call at the error from -* the probe callback. It's just a small helper for simplifying the error -* handling with the managed devices. -* -* Return: zero if successful, or a negative error code -*/ -int snd_card_free_on_error (struct device *dev,int ret) -{ -struct snd_card *card; - -if (!ret) -return 0 ; - card =devres_find (dev, __snd_card_release,NULL ,NULL ); -if (card) -snd_card_free (card); -return ret; -} -EXPORT_SYMBOL_GPL (snd_card_free_on_error); -static int snd_card_init (struct snd_card *card,struct device *parent,int idx,const char *xid,struct module *module,size_t extra_size)
Signature · 1 line
2.55.0