From: Daniel Mack <zonque@gmail.com>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>,
LKML <linux-kernel@vger.kernel.org>,
Rene Herman <rene.herman@gmail.com>, Takashi Iwai <tiwai@suse.de>
Subject: Re: genirq: Flags mismatch irq 5. 00000000 (ES1688) vs. 00000000
Date: Sat, 28 Jul 2012 17:13:53 +0200 [thread overview]
Message-ID: <501401B1.4070108@gmail.com> (raw)
In-Reply-To: <20120728132046.GA14210@localhost>
[-- Attachment #1: Type: text/plain, Size: 313 bytes --]
On 28.07.2012 15:20, Fengguang Wu wrote:
> (ES1688)
> Reply-To:
>
> Hi all,
>
> snd_es1688_create() seems not doing things right. It never frees the
> previously allocated resources on error return.. Anyone cares about
> this driver now?
Could you try the (not even compile-tested) patch attached?
Daniel
[-- Attachment #2: es1688.diff --]
[-- Type: text/x-patch, Size: 1680 bytes --]
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index 1d47be8..7cb309a 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -658,18 +658,25 @@ int snd_es1688_create(struct snd_card *card,
chip->irq = -1;
chip->dma8 = -1;
- if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) {
+ chip->res_port = request_region(port + 4, 12, "ES1688");
+ if (chip->res_port == NULL) {
snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
- return -EBUSY;
+ err = -EBUSY;
+ goto exit;
}
- if (request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip)) {
+
+ err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip);
+ if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
- return -EBUSY;
+ goto exit_release_region;
}
+
chip->irq = irq;
- if (request_dma(dma8, "ES1688")) {
+ err = request_dma(dma8, "ES1688");
+
+ if (err < 0) {
snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
- return -EBUSY;
+ goto exit_release_irq;
}
chip->dma8 = dma8;
@@ -685,14 +692,23 @@ int snd_es1688_create(struct snd_card *card,
err = snd_es1688_probe(chip);
if (err < 0)
- return err;
+ goto exit_release_dma;
err = snd_es1688_init(chip, 1);
if (err < 0)
- return err;
+ goto exit_release_dma;
/* Register device */
return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+
+exit_release_dma:
+ free_dma(chip->dma8);
+exit_release_irq:
+ free_irq(chip->irq, chip);
+exit_release_region:
+ release_and_free_resource(chip->res_port);
+exit:
+ return err;
}
static struct snd_pcm_ops snd_es1688_playback_ops = {
next prev parent reply other threads:[~2012-07-28 15:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-28 13:20 genirq: Flags mismatch irq 5. 00000000 (ES1688) vs. 00000000 Fengguang Wu
2012-07-28 15:13 ` Daniel Mack [this message]
2012-07-29 7:59 ` Takashi Iwai
2012-07-29 11:39 ` [PATCH] es1688 - freeup resources on init failure Fengguang Wu
2012-07-29 14:23 ` Daniel Mack
2012-07-30 8:23 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=501401B1.4070108@gmail.com \
--to=zonque@gmail.com \
--cc=fengguang.wu@intel.com \
--cc=krzysztof.h1@wp.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=rene.herman@gmail.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).