From: Takashi Iwai <tiwai@suse.de>
To: Zheyu Ma <zheyuma97@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] ALSA: echoaudio: warning when the driver fails to probe
Date: Mon, 11 Apr 2022 11:06:09 +0200 [thread overview]
Message-ID: <s5ha6csc7lq.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAMhUBjmr_mHcz2G0tQ2qktGFw6XDLJiDTAHvM1yoRWzvtA6MYg@mail.gmail.com>
On Mon, 11 Apr 2022 10:49:53 +0200,
Zheyu Ma wrote:
>
> On Mon, Apr 11, 2022 at 3:41 PM Takashi Iwai <tiwai@suse.de> wrote:
> >
> > On Sun, 10 Apr 2022 11:13:55 +0200,
> > Zheyu Ma wrote:
> > >
> > > Hello,
> > >
> > > I found a bug in echoaudio.c.
> > > When the driver fails at the function snd_echo_create(), it should
> > > release resources requested before, otherwise we will get the
> > > following warning:
> > >
> > > [ 3.262866] remove_proc_entry: removing non-empty directory
> > > 'irq/21', leaking at least 'snd_indigodj'
> > > [ 3.263577] WARNING: CPU: 3 PID: 261 at fs/proc/generic.c:717
> > > remove_proc_entry+0x389/0x3f0
> > > [ 3.267098] RIP: 0010:remove_proc_entry+0x389/0x3f0
> > > [ 3.269976] Call Trace:
> > > [ 3.269979] <TASK>
> > > [ 3.269988] unregister_irq_proc+0x14c/0x170
> > > [ 3.269997] irq_free_descs+0x94/0xe0
> > > [ 3.270004] mp_unmap_irq+0xb6/0x100
> > > [ 3.270011] acpi_unregister_gsi_ioapic+0x27/0x40
> > > [ 3.270017] acpi_pci_irq_disable+0x1d3/0x320
> > > [ 3.270025] pci_disable_device+0x1ad/0x380
> > > [ 3.270034] pcim_release+0x566/0x6d0
> > > [ 3.270046] devres_release_all+0x1f1/0x2c0
> > > [ 3.270057] really_probe+0xe0/0x920
> >
> > Could you try the patch below?
>
> The following patch works for me, the previous warning disappears, thank you.
> But I got another error, I have no idea about it.
OK, that's bad, it's basically the destructor order problem.
Could you try the patch below instead of the previous one?
thanks,
Takashi
---
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1889,13 +1889,20 @@ static void snd_echo_free(struct snd_card *card)
if (chip->comm_page)
rest_in_peace(chip);
- if (chip->irq >= 0)
- free_irq(chip->irq, chip);
-
/* release chip data */
free_firmware_cache(chip);
}
+static void do_free_irq(void *p)
+{
+ struct echoaudio *chip = p;
+
+ if (chip->irq >= 0) {
+ free_irq(chip->irq, chip);
+ chip->irq = -1;
+ }
+}
+
/* <--snd_echo_probe() */
static int snd_echo_create(struct snd_card *card,
struct pci_dev *pci)
@@ -1945,8 +1952,9 @@ static int snd_echo_create(struct snd_card *card,
card->sync_irq = chip->irq;
dev_dbg(card->dev, "pci=%p irq=%d subdev=%04x Init hardware...\n",
chip->pci, chip->irq, chip->pci->subsystem_device);
-
- card->private_free = snd_echo_free;
+ err = devm_add_action(card->dev, do_free_irq, chip);
+ if (err < 0)
+ return err;
/* Create the DSP comm page - this is the area of memory used for most
of the communication with the DSP, which accesses it via bus mastering */
@@ -1957,6 +1965,7 @@ static int snd_echo_create(struct snd_card *card,
return -ENOMEM;
chip->comm_page_phys = chip->commpage_dma_buf->addr;
chip->comm_page = (struct comm_page *)chip->commpage_dma_buf->area;
+ card->private_free = snd_echo_free;
err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);
if (err >= 0)
next prev parent reply other threads:[~2022-04-11 9:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-10 9:13 [BUG] ALSA: echoaudio: warning when the driver fails to probe Zheyu Ma
2022-04-11 7:41 ` Takashi Iwai
2022-04-11 8:49 ` Zheyu Ma
2022-04-11 9:06 ` Takashi Iwai [this message]
2022-04-11 9:15 ` Takashi Iwai
2022-04-11 10:30 ` Takashi Iwai
2022-04-11 10:34 ` Zheyu Ma
2022-04-11 15:14 ` Takashi Iwai
2022-04-12 1:36 ` Zheyu Ma
2022-04-12 9:28 ` 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=s5ha6csc7lq.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=zheyuma97@gmail.com \
/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).