All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 27/39] ALSA: sis7019: Fix the missing error handling
Date: Tue, 12 Apr 2022 12:26:24 +0200	[thread overview]
Message-ID: <20220412102636.16000-28-tiwai@suse.de> (raw)
In-Reply-To: <20220412102636.16000-1-tiwai@suse.de>

The previous cleanup with devres forgot to replace the snd_card_free()
call with the devm version.  Moreover, it still needs the manual call
of snd_card_free() at the probe error path, otherwise the reverse
order of the releases may happen.  This patch addresses those issues.

Fixes: 499ddc16394c ("ALSA: sis7019: Allocate resources with device-managed APIs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/sis7019.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 0b722b0e0604..fabe393607f8 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1331,8 +1331,8 @@ 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 sis7019 *sis;
@@ -1352,8 +1352,8 @@ static int snd_sis7019_probe(struct pci_dev *pci,
 	if (!codecs)
 		codecs = SIS_PRIMARY_CODEC_PRESENT;
 
-	rc = snd_card_new(&pci->dev, index, id, THIS_MODULE,
-			  sizeof(*sis), &card);
+	rc = snd_devm_card_new(&pci->dev, index, id, THIS_MODULE,
+			       sizeof(*sis), &card);
 	if (rc < 0)
 		return rc;
 
@@ -1386,6 +1386,12 @@ static int snd_sis7019_probe(struct pci_dev *pci,
 	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,
-- 
2.31.1


  parent reply	other threads:[~2022-04-12 10:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 10:25 [PATCH 00/39] ALSA: Fix error handling order at probe error Takashi Iwai
2022-04-12 10:25 ` [PATCH 01/39] ALSA: galaxy: Fix the missing snd_card_free() call " Takashi Iwai
2022-04-12 10:25 ` [PATCH 02/39] ALSA: sc6000: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 03/39] ALSA: ad1889: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 04/39] ALSA: ali5451: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 05/39] ALSA: als4000: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 06/39] ALSA: atiixp: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 07/39] ALSA: au88x0: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 08/39] ALSA: azt3328: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 09/39] ALSA: ca0106: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 10/39] ALSA: cs4281: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 11/39] ALSA: cs5535audio: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 12/39] ALSA: emu10k1x: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 13/39] ALSA: ens137x: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 14/39] ALSA: es1938: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 15/39] ALSA: es1968: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 16/39] ALSA: fm801: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 17/39] ALSA: ice1724: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 18/39] ALSA: intel8x0: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 19/39] ALSA: korg1212: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 20/39] ALSA: maestro3: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 21/39] ALSA: riptide: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 22/39] ALSA: rme32: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 23/39] ALSA: rme96: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 24/39] ALSA: sonicvibes: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 25/39] ALSA: via82xx: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 26/39] ALSA: intel_hdmi: " Takashi Iwai
2022-04-12 17:14   ` kernel test robot
2022-04-12 10:26 ` Takashi Iwai [this message]
2022-04-12 10:26 ` [PATCH 28/39] ALSA: bt87x: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 29/39] ALSA: lola: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 30/39] ALSA: als300: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 31/39] ALSA: aw2: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 32/39] ALSA: cmipci: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 33/39] ALSA: lx6464es: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 34/39] ALSA: oxygen: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 35/39] ALSA: hdsp: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 36/39] ALSA: hdspm: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 37/39] ALSA: rme9652: " Takashi Iwai
2022-04-12 10:26 ` [PATCH 38/39] ALSA: mtpav: Don't call card private_free at probe error path Takashi Iwai
2022-04-12 10:26 ` [PATCH 39/39] ALSA: nm256: " 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=20220412102636.16000-28-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.