alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Roy Spliet <nouveau@spliet.org>
Subject: [PATCH 1/6] ALSA: hda: Don't release card at firmware loading error
Date: Mon, 13 Apr 2020 10:20:29 +0200	[thread overview]
Message-ID: <20200413082034.25166-2-tiwai@suse.de> (raw)
In-Reply-To: <20200413082034.25166-1-tiwai@suse.de>

At the error path of the firmware loading error, the driver tries to
release the card object and set NULL to drvdata.  This may be referred
badly at the possible PM action, as the driver itself is still bound
and the PM callbacks read the card object.

Instead, we continue the probing as if it were no option set.  This is
often a better choice than the forced abort, too.

Fixes: 5cb543dba986 ("ALSA: hda - Deferred probing with request_firmware_nowait()")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207043
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_intel.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index bd093593f8fb..a2e811375750 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2027,24 +2027,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
 {
 	struct snd_card *card = context;
 	struct azx *chip = card->private_data;
-	struct pci_dev *pci = chip->pci;
-
-	if (!fw) {
-		dev_err(card->dev, "Cannot load firmware, aborting\n");
-		goto error;
-	}
 
-	chip->fw = fw;
+	if (fw)
+		chip->fw = fw;
+	else
+		dev_err(card->dev, "Cannot load firmware, continue without patching\n");
 	if (!chip->disabled) {
 		/* continue probing */
-		if (azx_probe_continue(chip))
-			goto error;
+		azx_probe_continue(chip);
 	}
-	return; /* OK */
-
- error:
-	snd_card_free(card);
-	pci_set_drvdata(pci, NULL);
 }
 #endif
 
-- 
2.16.4


  reply	other threads:[~2020-04-13  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13  8:20 [PATCH 0/6] ALSA: hda: Fix/improve no-codec bus Takashi Iwai
2020-04-13  8:20 ` Takashi Iwai [this message]
2020-04-13  8:20 ` [PATCH 2/6] ALSA: hda: Honor PM disablement in PM freeze and thaw_noirq ops Takashi Iwai
2020-04-13  8:20 ` [PATCH 3/6] ALSA: hda: Release resources at error in delayed probe Takashi Iwai
2020-04-13  8:20 ` [PATCH 4/6] ALSA: hda: Keep the controller initialization even if no codecs found Takashi Iwai
2020-04-13 10:52   ` Roy Spliet
2020-04-13  8:20 ` [PATCH 5/6] ALSA: hda: Skip controller resume if not needed Takashi Iwai
2020-04-13  8:20 ` [PATCH 6/6] ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported 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=20200413082034.25166-2-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=nouveau@spliet.org \
    /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).