From bd7dd77c2a05c530684eea2e3af16449ae9c5d52 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 28 Dec 2008 16:45:02 +0100 Subject: ALSA: Convert to snd_card_create() in other sound/* Convert from snd_card_new() to the new snd_card_create() function in other sound subdirectories. Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 8 ++++---- sound/pcmcia/vx/vxpocket.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 819aaaac432..183f6615c68 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -91,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device) */ static int snd_pdacf_probe(struct pcmcia_device *link) { - int i; + int i, err; struct snd_pdacf *pdacf; struct snd_card *card; static struct snd_device_ops ops = { @@ -112,10 +112,10 @@ static int snd_pdacf_probe(struct pcmcia_device *link) return -ENODEV; /* disabled explicitly */ /* ok, create a card instance */ - card = snd_card_new(index[i], id[i], THIS_MODULE, 0); - if (card == NULL) { + err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card); + if (err < 0) { snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); - return -ENOMEM; + return err; } pdacf = snd_pdacf_create(card); diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 706602a4060..087ded8a8d7 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -292,7 +292,7 @@ static int vxpocket_probe(struct pcmcia_device *p_dev) { struct snd_card *card; struct snd_vxpocket *vxp; - int i; + int i, err; /* find an empty slot from the card list */ for (i = 0; i < SNDRV_CARDS; i++) { @@ -307,10 +307,10 @@ static int vxpocket_probe(struct pcmcia_device *p_dev) return -ENODEV; /* disabled explicitly */ /* ok, create a card instance */ - card = snd_card_new(index[i], id[i], THIS_MODULE, 0); - if (card == NULL) { + err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card); + if (err < 0) { snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); - return -ENOMEM; + return err; } vxp = snd_vxpocket_new(card, ibl[i], p_dev); -- cgit v1.2.3 From aa3d75d80de464cf23af1d068a5e22f1527b6957 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 28 Dec 2008 16:59:41 +0100 Subject: ALSA: pdaudiocf - Fix missing free in the error path Added the missing snd_card_free() in the error path of probe callback. Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 183f6615c68..ec51569fd50 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -119,8 +119,10 @@ static int snd_pdacf_probe(struct pcmcia_device *link) } pdacf = snd_pdacf_create(card); - if (! pdacf) + if (!pdacf) { + snd_card_free(card); return -EIO; + } if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) { kfree(pdacf); -- cgit v1.2.3 From 2fa51107c9aa80ae95b4524198442cdea82d08a3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 28 Dec 2008 17:03:56 +0100 Subject: ALSA: Return proper error code at probe in sound/pcmcia/* Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 7 ++++--- sound/pcmcia/vx/vxpocket.c | 24 ++++++++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index ec51569fd50..7dea74b71cf 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -121,13 +121,14 @@ static int snd_pdacf_probe(struct pcmcia_device *link) pdacf = snd_pdacf_create(card); if (!pdacf) { snd_card_free(card); - return -EIO; + return -ENOMEM; } - if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) { + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops); + if (err < 0) { kfree(pdacf); snd_card_free(card); - return -ENODEV; + return err; } snd_card_set_dev(card, &handle_to_dev(link)); diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 087ded8a8d7..7445cc8a47d 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -130,23 +130,26 @@ static struct snd_vx_hardware vxp440_hw = { /* * create vxpocket instance */ -static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, - struct pcmcia_device *link) +static int snd_vxpocket_new(struct snd_card *card, int ibl, + struct pcmcia_device *link, + struct snd_vxpocket **chip_ret) { struct vx_core *chip; struct snd_vxpocket *vxp; static struct snd_device_ops ops = { .dev_free = snd_vxpocket_dev_free, }; + int err; chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); - if (! chip) - return NULL; + if (!chip) + return -ENOMEM; - if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) { + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); + if (err < 0) { kfree(chip); - return NULL; + return err; } chip->ibl.size = ibl; @@ -169,7 +172,8 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, link->conf.ConfigIndex = 1; link->conf.Present = PRESENT_OPTION; - return vxp; + *chip_ret = vxp; + return 0; } @@ -313,10 +317,10 @@ static int vxpocket_probe(struct pcmcia_device *p_dev) return err; } - vxp = snd_vxpocket_new(card, ibl[i], p_dev); - if (! vxp) { + err = snd_vxpocket_new(card, ibl[i], p_dev, &vxp); + if (err < 0) { snd_card_free(card); - return -ENODEV; + return err; } card->private_data = vxp; -- cgit v1.2.3 From 2ebfb8eeb8f244f9d25937d31a947895cf819e26 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 5 Feb 2009 16:11:58 +0100 Subject: ALSA: Add missing KERN_* prefix to printk in other sound/* Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 23 +++++++++++++++-------- sound/pcmcia/pdaudiocf/pdaudiocf_irq.c | 4 ++-- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index dfa40b0ed86..5d2afa0b0ce 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c @@ -82,14 +82,21 @@ static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned c #if 0 void pdacf_dump(struct snd_pdacf *chip) { - printk("PDAUDIOCF DUMP (0x%lx):\n", chip->port); - printk("WPD : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_WDP)); - printk("RDP : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_RDP)); - printk("TCR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_TCR)); - printk("SCR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_SCR)); - printk("ISR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_ISR)); - printk("IER : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_IER)); - printk("AK_IFR : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_AK_IFR)); + printk(KERN_DEBUG "PDAUDIOCF DUMP (0x%lx):\n", chip->port); + printk(KERN_DEBUG "WPD : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_WDP)); + printk(KERN_DEBUG "RDP : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_RDP)); + printk(KERN_DEBUG "TCR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_TCR)); + printk(KERN_DEBUG "SCR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_SCR)); + printk(KERN_DEBUG "ISR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_ISR)); + printk(KERN_DEBUG "IER : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_IER)); + printk(KERN_DEBUG "AK_IFR : 0x%x\n", + inw(chip->port + PDAUDIOCF_REG_AK_IFR)); } #endif diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c index ea903c8e90d..dcd32201bc8 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c @@ -269,7 +269,7 @@ void pdacf_tasklet(unsigned long private_data) rdp = inw(chip->port + PDAUDIOCF_REG_RDP); wdp = inw(chip->port + PDAUDIOCF_REG_WDP); - // printk("TASKLET: rdp = %x, wdp = %x\n", rdp, wdp); + /* printk(KERN_DEBUG "TASKLET: rdp = %x, wdp = %x\n", rdp, wdp); */ size = wdp - rdp; if (size < 0) size += 0x10000; @@ -321,5 +321,5 @@ void pdacf_tasklet(unsigned long private_data) spin_lock(&chip->reg_lock); } spin_unlock(&chip->reg_lock); - // printk("TASKLET: end\n"); + /* printk(KERN_DEBUG "TASKLET: end\n"); */ } -- cgit v1.2.3