From: Greg Kroah-Hartman Date: Fri, 15 Apr 2022 10:51:45 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v4.19.238~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a1918cb291b8910af7a7fb3ea9d77e838c326d5;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: alsa-ali5451-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-als300-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-als4000-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-atiixp-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-au88x0-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-aw2-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-azt3328-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-bt87x-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-ca0106-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-cmipci-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-cs4281-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-cs5535audio-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-echoaudio-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-emu10k1x-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-ens137x-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-es1938-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-es1968-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-fm801-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-galaxy-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-hdsp-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-hdspm-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-ice1724-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-intel8x0-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-intel_hdmi-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-korg1212-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-lola-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-lx6464es-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-maestro3-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-oxygen-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-riptide-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-rme32-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-rme96-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-rme9652-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-sc6000-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-sonicvibes-fix-the-missing-snd_card_free-call-at-probe-error.patch alsa-usb-audio-cap-upper-limits-of-buffer-period-bytes-for-implicit-fb.patch alsa-via82xx-fix-the-missing-snd_card_free-call-at-probe-error.patch --- diff --git a/queue-5.15/alsa-ali5451-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-ali5451-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..fbf00d218cb --- /dev/null +++ b/queue-5.15/alsa-ali5451-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From 19401a9441236cfbbbeb1bef4ef4c8668db45dfc Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:01 +0200 +Subject: ALSA: ali5451: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 19401a9441236cfbbbeb1bef4ef4c8668db45dfc upstream. + +The recent cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 1f0819979248 ("ALSA: ali5451: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-5-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/ali5451/ali5451.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c +index 92eb59db106d..2378a39abaeb 100644 +--- a/sound/pci/ali5451/ali5451.c ++++ b/sound/pci/ali5451/ali5451.c +@@ -2124,8 +2124,8 @@ static int snd_ali_create(struct snd_card *card, + return 0; + } + +-static int snd_ali_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_ali_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct snd_ali *codec; +@@ -2170,6 +2170,12 @@ static int snd_ali_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_ali_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_ali_probe(pci, pci_id)); ++} ++ + static struct pci_driver ali5451_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_ali_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-als300-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-als300-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..582cfd01d9b --- /dev/null +++ b/queue-5.15/alsa-als300-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,60 @@ +From ab8bce9da6102c575c473c053672547589bc4c59 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:27 +0200 +Subject: ALSA: als300: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit ab8bce9da6102c575c473c053672547589bc4c59 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: 21a9314cf93b ("ALSA: als300: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-31-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/als300.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/als300.c b/sound/pci/als300.c +index b86565dcdbe4..c70aff060120 100644 +--- a/sound/pci/als300.c ++++ b/sound/pci/als300.c +@@ -708,7 +708,7 @@ static int snd_als300_probe(struct pci_dev *pci, + + err = snd_als300_create(card, pci, chip_type); + if (err < 0) +- return err; ++ goto error; + + strcpy(card->driver, "ALS300"); + if (chip->chip_type == DEVICE_ALS300_PLUS) +@@ -723,11 +723,15 @@ static int snd_als300_probe(struct pci_dev *pci, + + err = snd_card_register(card); + if (err < 0) +- return err; ++ goto error; + + pci_set_drvdata(pci, card); + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + static struct pci_driver als300_driver = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-als4000-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-als4000-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..697d72e7cb6 --- /dev/null +++ b/queue-5.15/alsa-als4000-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,53 @@ +From d616a0246da88d811f9f4c3aa83003c05efd3af0 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:02 +0200 +Subject: ALSA: als4000: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit d616a0246da88d811f9f4c3aa83003c05efd3af0 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 0e175f665960 ("ALSA: als4000: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-6-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/als4000.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/sound/pci/als4000.c ++++ b/sound/pci/als4000.c +@@ -806,8 +806,8 @@ static void snd_card_als4000_free( struc + snd_als4000_free_gameport(acard); + } + +-static int snd_card_als4000_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_card_als4000_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -930,6 +930,12 @@ static int snd_card_als4000_probe(struct + return 0; + } + ++static int snd_card_als4000_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_card_als4000_probe(pci, pci_id)); ++} ++ + #ifdef CONFIG_PM_SLEEP + static int snd_als4000_suspend(struct device *dev) + { diff --git a/queue-5.15/alsa-atiixp-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-atiixp-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..e50ceced6e2 --- /dev/null +++ b/queue-5.15/alsa-atiixp-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,87 @@ +From 48e8adde8d1c586c799dab123fc1ebc8b8db620f Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:03 +0200 +Subject: ALSA: atiixp: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 48e8adde8d1c586c799dab123fc1ebc8b8db620f upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 86bde74dbf09 ("ALSA: atiixp: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-7-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/atiixp.c | 10 ++++++++-- + sound/pci/atiixp_modem.c | 10 ++++++++-- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c +index b8e035d5930d..43d01f1847ed 100644 +--- a/sound/pci/atiixp.c ++++ b/sound/pci/atiixp.c +@@ -1572,8 +1572,8 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci) + } + + +-static int snd_atiixp_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_atiixp_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct atiixp *chip; +@@ -1623,6 +1623,12 @@ static int snd_atiixp_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_atiixp_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id)); ++} ++ + static struct pci_driver atiixp_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_atiixp_ids, +diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c +index 178dce8ef1e9..8864c4c3c7e1 100644 +--- a/sound/pci/atiixp_modem.c ++++ b/sound/pci/atiixp_modem.c +@@ -1201,8 +1201,8 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci) + } + + +-static int snd_atiixp_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_atiixp_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct atiixp_modem *chip; +@@ -1247,6 +1247,12 @@ static int snd_atiixp_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_atiixp_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id)); ++} ++ + static struct pci_driver atiixp_modem_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_atiixp_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-au88x0-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-au88x0-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..8f207f175fe --- /dev/null +++ b/queue-5.15/alsa-au88x0-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,56 @@ +From b093de145bc8769c6e9207947afad9efe102f4f6 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:04 +0200 +Subject: ALSA: au88x0: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit b093de145bc8769c6e9207947afad9efe102f4f6 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: e44b5b440609 ("ALSA: au88x0: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-8-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/au88x0/au88x0.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c +index 342ef2a6655e..eb234153691b 100644 +--- a/sound/pci/au88x0/au88x0.c ++++ b/sound/pci/au88x0/au88x0.c +@@ -193,7 +193,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci) + + // constructor -- see "Constructor" sub-section + static int +-snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++__snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -310,6 +310,12 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + return 0; + } + ++static int ++snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_vortex_probe(pci, pci_id)); ++} ++ + // pci_driver definition + static struct pci_driver vortex_driver = { + .name = KBUILD_MODNAME, +-- +2.35.2 + diff --git a/queue-5.15/alsa-aw2-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-aw2-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..971e8a07617 --- /dev/null +++ b/queue-5.15/alsa-aw2-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,62 @@ +From bf4067e8a19eae67c45659a956c361d59251ba57 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:28 +0200 +Subject: ALSA: aw2: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit bf4067e8a19eae67c45659a956c361d59251ba57 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: 33631012cd06 ("ALSA: aw2: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-32-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/aw2/aw2-alsa.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c +index d56f126d6fdd..29a4bcdec237 100644 +--- a/sound/pci/aw2/aw2-alsa.c ++++ b/sound/pci/aw2/aw2-alsa.c +@@ -275,7 +275,7 @@ static int snd_aw2_probe(struct pci_dev *pci, + /* (3) Create main component */ + err = snd_aw2_create(card, pci); + if (err < 0) +- return err; ++ goto error; + + /* initialize mutex */ + mutex_init(&chip->mtx); +@@ -294,13 +294,17 @@ static int snd_aw2_probe(struct pci_dev *pci, + /* (6) Register card instance */ + err = snd_card_register(card); + if (err < 0) +- return err; ++ goto error; + + /* (7) Set PCI driver data */ + pci_set_drvdata(pci, card); + + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + /* open callback */ +-- +2.35.2 + diff --git a/queue-5.15/alsa-azt3328-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-azt3328-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..80dd070c290 --- /dev/null +++ b/queue-5.15/alsa-azt3328-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,56 @@ +From 49fe36e1c02cb06f66689c888e4e767c31cd259d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:05 +0200 +Subject: ALSA: azt3328: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 49fe36e1c02cb06f66689c888e4e767c31cd259d upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 8c5823ef31e1 ("ALSA: azt3328: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-9-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/azt3328.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c +index 089050470ff2..7f329dfc5404 100644 +--- a/sound/pci/azt3328.c ++++ b/sound/pci/azt3328.c +@@ -2427,7 +2427,7 @@ snd_azf3328_create(struct snd_card *card, + } + + static int +-snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++__snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2520,6 +2520,12 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + return 0; + } + ++static int ++snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_azf3328_probe(pci, pci_id)); ++} ++ + #ifdef CONFIG_PM_SLEEP + static inline void + snd_azf3328_suspend_regs(const struct snd_azf3328 *chip, +-- +2.35.2 + diff --git a/queue-5.15/alsa-bt87x-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-bt87x-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..48d03473e59 --- /dev/null +++ b/queue-5.15/alsa-bt87x-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From f0438155273f057fec9818bc9d1b782ba35cf6a1 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:25 +0200 +Subject: ALSA: bt87x: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit f0438155273f057fec9818bc9d1b782ba35cf6a1 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 9e80ed64a006 ("ALSA: bt87x: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-29-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/bt87x.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c +index d23f93163841..621985bfee5d 100644 +--- a/sound/pci/bt87x.c ++++ b/sound/pci/bt87x.c +@@ -805,8 +805,8 @@ static int snd_bt87x_detect_card(struct pci_dev *pci) + return SND_BT87X_BOARD_UNKNOWN; + } + +-static int snd_bt87x_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_bt87x_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -889,6 +889,12 @@ static int snd_bt87x_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_bt87x_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_bt87x_probe(pci, pci_id)); ++} ++ + /* default entries for all Bt87x cards - it's not exported */ + /* driver_data is set to 0 to call detection */ + static const struct pci_device_id snd_bt87x_default_ids[] = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-ca0106-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-ca0106-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..f7f6dc313d4 --- /dev/null +++ b/queue-5.15/alsa-ca0106-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From c79442cc5a38e46597bc647128c8f1de62d80020 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:06 +0200 +Subject: ALSA: ca0106: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit c79442cc5a38e46597bc647128c8f1de62d80020 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 1656fa6ea258 ("ALSA: ca0106: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-10-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/ca0106/ca0106_main.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c +index 8577f9fa5ea6..cf1bac7a435f 100644 +--- a/sound/pci/ca0106/ca0106_main.c ++++ b/sound/pci/ca0106/ca0106_main.c +@@ -1725,8 +1725,8 @@ static int snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int channel) + } + + +-static int snd_ca0106_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_ca0106_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -1786,6 +1786,12 @@ static int snd_ca0106_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_ca0106_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_ca0106_probe(pci, pci_id)); ++} ++ + #ifdef CONFIG_PM_SLEEP + static int snd_ca0106_suspend(struct device *dev) + { +-- +2.35.2 + diff --git a/queue-5.15/alsa-cmipci-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-cmipci-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..ed0f4e00541 --- /dev/null +++ b/queue-5.15/alsa-cmipci-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,51 @@ +From a59396b1c11823c69c31621198c04def17f3a869 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:29 +0200 +Subject: ALSA: cmipci: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit a59396b1c11823c69c31621198c04def17f3a869 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: 87e082ad84a7 ("ALSA: cmipci: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-33-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/cmipci.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/sound/pci/cmipci.c ++++ b/sound/pci/cmipci.c +@@ -3249,15 +3249,19 @@ static int snd_cmipci_probe(struct pci_d + + err = snd_cmipci_create(card, pci, dev); + if (err < 0) +- return err; ++ goto error; + + err = snd_card_register(card); + if (err < 0) +- return err; ++ goto error; + + pci_set_drvdata(pci, card); + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + #ifdef CONFIG_PM_SLEEP diff --git a/queue-5.15/alsa-cs4281-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-cs4281-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..4d8297b6302 --- /dev/null +++ b/queue-5.15/alsa-cs4281-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From 9bf5ed9a4e623583f15202d99f4521bc39050f61 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:07 +0200 +Subject: ALSA: cs4281: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 9bf5ed9a4e623583f15202d99f4521bc39050f61 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 99041fea70d0 ("ALSA: cs4281: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-11-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/cs4281.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c +index e7367402b84a..0c9cadf7b3b8 100644 +--- a/sound/pci/cs4281.c ++++ b/sound/pci/cs4281.c +@@ -1827,8 +1827,8 @@ static void snd_cs4281_opl3_command(struct snd_opl3 *opl3, unsigned short cmd, + spin_unlock_irqrestore(&opl3->reg_lock, flags); + } + +-static int snd_cs4281_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_cs4281_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -1888,6 +1888,12 @@ static int snd_cs4281_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_cs4281_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_cs4281_probe(pci, pci_id)); ++} ++ + /* + * Power Management + */ +-- +2.35.2 + diff --git a/queue-5.15/alsa-cs5535audio-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-cs5535audio-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..eb85a68d1d3 --- /dev/null +++ b/queue-5.15/alsa-cs5535audio-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,55 @@ +From 2a56314798e0227cf51e3d1d184a419dc07bc173 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:08 +0200 +Subject: ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 2a56314798e0227cf51e3d1d184a419dc07bc173 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +Fixes: 5eba4c646dfe ("ALSA: cs5535audio: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-12-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/cs5535audio/cs5535audio.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c +index 499fa0148f9a..440b8f9b40c9 100644 +--- a/sound/pci/cs5535audio/cs5535audio.c ++++ b/sound/pci/cs5535audio/cs5535audio.c +@@ -281,8 +281,8 @@ static int snd_cs5535audio_create(struct snd_card *card, + return 0; + } + +-static int snd_cs5535audio_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_cs5535audio_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -331,6 +331,12 @@ static int snd_cs5535audio_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_cs5535audio_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_cs5535audio_probe(pci, pci_id)); ++} ++ + static struct pci_driver cs5535audio_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_cs5535audio_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-echoaudio-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-echoaudio-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..2f8a0228871 --- /dev/null +++ b/queue-5.15/alsa-echoaudio-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,59 @@ +From 313c7e57035125cb7533b53ddd0bc7aa562b433c Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 11:31:41 +0200 +Subject: ALSA: echoaudio: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 313c7e57035125cb7533b53ddd0bc7aa562b433c upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 9c211bf392bb ("ALSA: echoaudio: Allocate resources with device-managed APIs") +Reported-and-tested-by: Zheyu Ma +Cc: +Link: https://lore.kernel.org/r/CAMhUBjm2AdyEZ_-EgexdNDN7SvY4f89=4=FwAL+c0Mg0O+X50A@mail.gmail.com +Link: https://lore.kernel.org/r/20220412093141.8008-3-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/echoaudio/echoaudio.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c +index 25b012ef5c3e..c70c3ac4e99a 100644 +--- a/sound/pci/echoaudio/echoaudio.c ++++ b/sound/pci/echoaudio/echoaudio.c +@@ -1970,8 +1970,8 @@ static int snd_echo_create(struct snd_card *card, + } + + /* constructor */ +-static int snd_echo_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_echo_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2139,6 +2139,11 @@ static int snd_echo_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_echo_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_echo_probe(pci, pci_id)); ++} + + + #if defined(CONFIG_PM_SLEEP) +-- +2.35.2 + diff --git a/queue-5.15/alsa-emu10k1x-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-emu10k1x-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..d9808aeeea9 --- /dev/null +++ b/queue-5.15/alsa-emu10k1x-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From f37019b6bfe2e13cc536af0e6a42ed62005392ae Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:09 +0200 +Subject: ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit f37019b6bfe2e13cc536af0e6a42ed62005392ae upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 2b377c6b6012 ("ALSA: emu10k1x: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-13-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/emu10k1/emu10k1x.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c +index c49c44dc1082..89043392f3ec 100644 +--- a/sound/pci/emu10k1/emu10k1x.c ++++ b/sound/pci/emu10k1/emu10k1x.c +@@ -1491,8 +1491,8 @@ static int snd_emu10k1x_midi(struct emu10k1x *emu) + return 0; + } + +-static int snd_emu10k1x_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_emu10k1x_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -1554,6 +1554,12 @@ static int snd_emu10k1x_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_emu10k1x_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_emu10k1x_probe(pci, pci_id)); ++} ++ + // PCI IDs + static const struct pci_device_id snd_emu10k1x_ids[] = { + { PCI_VDEVICE(CREATIVE, 0x0006), 0 }, /* Dell OEM version (EMU10K1) */ +-- +2.35.2 + diff --git a/queue-5.15/alsa-ens137x-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-ens137x-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..8c66bee8084 --- /dev/null +++ b/queue-5.15/alsa-ens137x-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From c2dc46932d117a1505f589ad1db3095aa6789058 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:10 +0200 +Subject: ALSA: ens137x: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit c2dc46932d117a1505f589ad1db3095aa6789058 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 10ed6eaf9d72 ("ALSA: ens137x: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-14-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/ens1370.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c +index 2651f0c64c06..94efe347a97a 100644 +--- a/sound/pci/ens1370.c ++++ b/sound/pci/ens1370.c +@@ -2304,8 +2304,8 @@ static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id) + return IRQ_HANDLED; + } + +-static int snd_audiopci_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_audiopci_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2369,6 +2369,12 @@ static int snd_audiopci_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_audiopci_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_audiopci_probe(pci, pci_id)); ++} ++ + static struct pci_driver ens137x_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_audiopci_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-es1938-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-es1938-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..e1001ab508c --- /dev/null +++ b/queue-5.15/alsa-es1938-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From bc22628591e5913e67edb3c2a89b97849e30a8f8 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:11 +0200 +Subject: ALSA: es1938: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit bc22628591e5913e67edb3c2a89b97849e30a8f8 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 08e9d3ab4cc1 ("ALSA: es1938: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-15-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/es1938.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c +index 00b976f42a3d..e34ec6f89e7e 100644 +--- a/sound/pci/es1938.c ++++ b/sound/pci/es1938.c +@@ -1716,8 +1716,8 @@ static int snd_es1938_mixer(struct es1938 *chip) + } + + +-static int snd_es1938_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_es1938_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -1796,6 +1796,12 @@ static int snd_es1938_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_es1938_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_es1938_probe(pci, pci_id)); ++} ++ + static struct pci_driver es1938_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_es1938_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-es1968-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-es1968-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..691a3d25f3e --- /dev/null +++ b/queue-5.15/alsa-es1968-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From de9a01bc95a9e5e36d0659521bb04579053d8566 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:12 +0200 +Subject: ALSA: es1968: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit de9a01bc95a9e5e36d0659521bb04579053d8566 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: a7b4cbfdc701 ("ALSA: es1968: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-16-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/es1968.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c +index 6a8a02a9ecf4..4a7e20bb11bc 100644 +--- a/sound/pci/es1968.c ++++ b/sound/pci/es1968.c +@@ -2741,8 +2741,8 @@ static int snd_es1968_create(struct snd_card *card, + + /* + */ +-static int snd_es1968_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_es1968_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2848,6 +2848,12 @@ static int snd_es1968_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_es1968_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_es1968_probe(pci, pci_id)); ++} ++ + static struct pci_driver es1968_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_es1968_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-fm801-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-fm801-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..19160acc61c --- /dev/null +++ b/queue-5.15/alsa-fm801-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From 7f611274a3d1657a67b3fa8cd0cec1dee00e02b4 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:13 +0200 +Subject: ALSA: fm801: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 7f611274a3d1657a67b3fa8cd0cec1dee00e02b4 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 47c413395376 ("ALSA: fm801: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-17-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/fm801.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c +index 9c22ff19e56d..62b3cb126c6d 100644 +--- a/sound/pci/fm801.c ++++ b/sound/pci/fm801.c +@@ -1268,8 +1268,8 @@ static int snd_fm801_create(struct snd_card *card, + return 0; + } + +-static int snd_card_fm801_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_card_fm801_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -1333,6 +1333,12 @@ static int snd_card_fm801_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_card_fm801_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_card_fm801_probe(pci, pci_id)); ++} ++ + #ifdef CONFIG_PM_SLEEP + static const unsigned char saved_regs[] = { + FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC, +-- +2.35.2 + diff --git a/queue-5.15/alsa-galaxy-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-galaxy-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..fb6602f25f0 --- /dev/null +++ b/queue-5.15/alsa-galaxy-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,55 @@ +From 10b1881a97be240126891cb384bd3bc1869f52d8 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:25:58 +0200 +Subject: ALSA: galaxy: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 10b1881a97be240126891cb384bd3bc1869f52d8 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 35a245ec0619 ("ALSA: galaxy: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-2-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/isa/galaxy/galaxy.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c +index ea001c80149d..3164eb8510fa 100644 +--- a/sound/isa/galaxy/galaxy.c ++++ b/sound/isa/galaxy/galaxy.c +@@ -478,7 +478,7 @@ static void snd_galaxy_free(struct snd_card *card) + galaxy_set_config(galaxy, galaxy->config); + } + +-static int snd_galaxy_probe(struct device *dev, unsigned int n) ++static int __snd_galaxy_probe(struct device *dev, unsigned int n) + { + struct snd_galaxy *galaxy; + struct snd_wss *chip; +@@ -598,6 +598,11 @@ static int snd_galaxy_probe(struct device *dev, unsigned int n) + return 0; + } + ++static int snd_galaxy_probe(struct device *dev, unsigned int n) ++{ ++ return snd_card_free_on_error(dev, __snd_galaxy_probe(dev, n)); ++} ++ + static struct isa_driver snd_galaxy_driver = { + .match = snd_galaxy_match, + .probe = snd_galaxy_probe, +-- +2.35.2 + diff --git a/queue-5.15/alsa-hdsp-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-hdsp-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..290f321c273 --- /dev/null +++ b/queue-5.15/alsa-hdsp-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From e2263f0bf7443a200a5c1c418baefd92f1674600 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:32 +0200 +Subject: ALSA: hdsp: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit e2263f0bf7443a200a5c1c418baefd92f1674600 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: d136b8e54f92 ("ALSA: hdsp: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-36-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/rme9652/hdsp.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c +index 96c12dfb24cf..3db641318d3a 100644 +--- a/sound/pci/rme9652/hdsp.c ++++ b/sound/pci/rme9652/hdsp.c +@@ -5444,17 +5444,21 @@ static int snd_hdsp_probe(struct pci_dev *pci, + hdsp->pci = pci; + err = snd_hdsp_create(card, hdsp); + if (err) +- return err; ++ goto error; + + strcpy(card->shortname, "Hammerfall DSP"); + sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, + hdsp->port, hdsp->irq); + err = snd_card_register(card); + if (err) +- return err; ++ goto error; + pci_set_drvdata(pci, card); + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + static struct pci_driver hdsp_driver = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-hdspm-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-hdspm-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..1e72d9c7142 --- /dev/null +++ b/queue-5.15/alsa-hdspm-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,61 @@ +From eab521aebcdeb1c801009503e3a7f8989e3c6b36 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:33 +0200 +Subject: ALSA: hdspm: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit eab521aebcdeb1c801009503e3a7f8989e3c6b36 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: 0195ca5fd1f4 ("ALSA: hdspm: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-37-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/rme9652/hdspm.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c +index ff06ee82607c..fa1812e7a49d 100644 +--- a/sound/pci/rme9652/hdspm.c ++++ b/sound/pci/rme9652/hdspm.c +@@ -6895,7 +6895,7 @@ static int snd_hdspm_probe(struct pci_dev *pci, + + err = snd_hdspm_create(card, hdspm); + if (err < 0) +- return err; ++ goto error; + + if (hdspm->io_type != MADIface) { + snprintf(card->shortname, sizeof(card->shortname), "%s_%x", +@@ -6914,12 +6914,16 @@ static int snd_hdspm_probe(struct pci_dev *pci, + + err = snd_card_register(card); + if (err < 0) +- return err; ++ goto error; + + pci_set_drvdata(pci, card); + + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + static struct pci_driver hdspm_driver = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-ice1724-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-ice1724-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..b3498a549f1 --- /dev/null +++ b/queue-5.15/alsa-ice1724-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From 4a850a0079ce601c0c4016f4edb7d618e811ed7d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:14 +0200 +Subject: ALSA: ice1724: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 4a850a0079ce601c0c4016f4edb7d618e811ed7d upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 314f6dbb1f33 ("ALSA: ice1724: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-18-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/ice1712/ice1724.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c +index f6275868877a..6fab2ad85bbe 100644 +--- a/sound/pci/ice1712/ice1724.c ++++ b/sound/pci/ice1712/ice1724.c +@@ -2519,8 +2519,8 @@ static int snd_vt1724_create(struct snd_card *card, + * + */ + +-static int snd_vt1724_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_vt1724_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2662,6 +2662,12 @@ static int snd_vt1724_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_vt1724_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_vt1724_probe(pci, pci_id)); ++} ++ + #ifdef CONFIG_PM_SLEEP + static int snd_vt1724_suspend(struct device *dev) + { +-- +2.35.2 + diff --git a/queue-5.15/alsa-intel8x0-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-intel8x0-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..dcc43c15cc9 --- /dev/null +++ b/queue-5.15/alsa-intel8x0-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,87 @@ +From 71b21f5f8970a87f034138454ebeff0608d24875 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:15 +0200 +Subject: ALSA: intel8x0: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 71b21f5f8970a87f034138454ebeff0608d24875 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 7835e0901e24 ("ALSA: intel8x0: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-19-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/intel8x0.c | 10 ++++++++-- + sound/pci/intel8x0m.c | 10 ++++++++-- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c +index a51032b3ac4d..ae285c0a629c 100644 +--- a/sound/pci/intel8x0.c ++++ b/sound/pci/intel8x0.c +@@ -3109,8 +3109,8 @@ static int check_default_spdif_aclink(struct pci_dev *pci) + return 0; + } + +-static int snd_intel8x0_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_intel8x0_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct intel8x0 *chip; +@@ -3189,6 +3189,12 @@ static int snd_intel8x0_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_intel8x0_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_intel8x0_probe(pci, pci_id)); ++} ++ + static struct pci_driver intel8x0_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_intel8x0_ids, +diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c +index 7de3cb2f17b5..2845cc006d0c 100644 +--- a/sound/pci/intel8x0m.c ++++ b/sound/pci/intel8x0m.c +@@ -1178,8 +1178,8 @@ static struct shortname_table { + { 0 }, + }; + +-static int snd_intel8x0m_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_intel8x0m_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct intel8x0m *chip; +@@ -1225,6 +1225,12 @@ static int snd_intel8x0m_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_intel8x0m_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_intel8x0m_probe(pci, pci_id)); ++} ++ + static struct pci_driver intel8x0m_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_intel8x0m_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-intel_hdmi-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-intel_hdmi-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..b2212938d01 --- /dev/null +++ b/queue-5.15/alsa-intel_hdmi-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,50 @@ +From 5e154dfb4f9995096aa6d342df75040ae802c17e Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:23 +0200 +Subject: ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 5e154dfb4f9995096aa6d342df75040ae802c17e upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 854577ac2aea ("ALSA: x86: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-27-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/x86/intel_hdmi_audio.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/sound/x86/intel_hdmi_audio.c ++++ b/sound/x86/intel_hdmi_audio.c +@@ -1665,7 +1665,7 @@ static void hdmi_lpe_audio_free(struct s + * This function is called when the i915 driver creates the + * hdmi-lpe-audio platform device. + */ +-static int hdmi_lpe_audio_probe(struct platform_device *pdev) ++static int __hdmi_lpe_audio_probe(struct platform_device *pdev) + { + struct snd_card *card; + struct snd_intelhad_card *card_ctx; +@@ -1826,6 +1826,11 @@ static int hdmi_lpe_audio_probe(struct p + return 0; + } + ++static int hdmi_lpe_audio_probe(struct platform_device *pdev) ++{ ++ return snd_card_free_on_error(&pdev->dev, __hdmi_lpe_audio_probe(pdev)); ++} ++ + static const struct dev_pm_ops hdmi_lpe_audio_pm = { + SET_SYSTEM_SLEEP_PM_OPS(hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) + }; diff --git a/queue-5.15/alsa-korg1212-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-korg1212-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..134ac20b53d --- /dev/null +++ b/queue-5.15/alsa-korg1212-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,59 @@ +From c01b723a56ce18ae66ff18c5803942badc15fbcd Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:16 +0200 +Subject: ALSA: korg1212: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit c01b723a56ce18ae66ff18c5803942badc15fbcd upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-20-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/korg1212/korg1212.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c +index 5c9e240ff6a9..33b4f95d65b3 100644 +--- a/sound/pci/korg1212/korg1212.c ++++ b/sound/pci/korg1212/korg1212.c +@@ -2355,7 +2355,7 @@ snd_korg1212_probe(struct pci_dev *pci, + + err = snd_korg1212_create(card, pci); + if (err < 0) +- return err; ++ goto error; + + strcpy(card->driver, "korg1212"); + strcpy(card->shortname, "korg1212"); +@@ -2366,10 +2366,14 @@ snd_korg1212_probe(struct pci_dev *pci, + + err = snd_card_register(card); + if (err < 0) +- return err; ++ goto error; + pci_set_drvdata(pci, card); + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + static struct pci_driver korg1212_driver = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-lola-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-lola-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..e8833e93c93 --- /dev/null +++ b/queue-5.15/alsa-lola-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From d04e84b9817c652002f0ee9b42059d41493e9118 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:26 +0200 +Subject: ALSA: lola: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit d04e84b9817c652002f0ee9b42059d41493e9118 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 098fe3d6e775 ("ALSA: lola: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-30-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/lola/lola.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c +index 5269a1d396a5..1aa30e90b86a 100644 +--- a/sound/pci/lola/lola.c ++++ b/sound/pci/lola/lola.c +@@ -637,8 +637,8 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev) + return 0; + } + +-static int lola_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __lola_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -687,6 +687,12 @@ static int lola_probe(struct pci_dev *pci, + return 0; + } + ++static int lola_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __lola_probe(pci, pci_id)); ++} ++ + /* PCI IDs */ + static const struct pci_device_id lola_ids[] = { + { PCI_VDEVICE(DIGIGRAM, 0x0001) }, +-- +2.35.2 + diff --git a/queue-5.15/alsa-lx6464es-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-lx6464es-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..dd93d15786c --- /dev/null +++ b/queue-5.15/alsa-lx6464es-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,61 @@ +From 60797a21dd8360a99ba797f8ca587087c07bb54c Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:30 +0200 +Subject: ALSA: lx6464es: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 60797a21dd8360a99ba797f8ca587087c07bb54c upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: 6f16c19b115e ("ALSA: lx6464es: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-34-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/lx6464es/lx6464es.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c +index 168a1084f730..bd9b6148dd6f 100644 +--- a/sound/pci/lx6464es/lx6464es.c ++++ b/sound/pci/lx6464es/lx6464es.c +@@ -1019,7 +1019,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci, + err = snd_lx6464es_create(card, pci); + if (err < 0) { + dev_err(card->dev, "error during snd_lx6464es_create\n"); +- return err; ++ goto error; + } + + strcpy(card->driver, "LX6464ES"); +@@ -1036,12 +1036,16 @@ static int snd_lx6464es_probe(struct pci_dev *pci, + + err = snd_card_register(card); + if (err < 0) +- return err; ++ goto error; + + dev_dbg(chip->card->dev, "initialization successful\n"); + pci_set_drvdata(pci, card); + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + static struct pci_driver lx6464es_driver = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-maestro3-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-maestro3-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..7cfd3f34a3c --- /dev/null +++ b/queue-5.15/alsa-maestro3-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,56 @@ +From ae86bf5c2a8d81418eadf1c31dd9253b609e3093 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:17 +0200 +Subject: ALSA: maestro3: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit ae86bf5c2a8d81418eadf1c31dd9253b609e3093 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 5c0939253c3c ("ALSA: maestro3: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-21-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/maestro3.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c +index 056838ead21d..261850775c80 100644 +--- a/sound/pci/maestro3.c ++++ b/sound/pci/maestro3.c +@@ -2637,7 +2637,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, + /* + */ + static int +-snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++__snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2702,6 +2702,12 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + return 0; + } + ++static int ++snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_m3_probe(pci, pci_id)); ++} ++ + static struct pci_driver m3_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_m3_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-oxygen-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-oxygen-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..04750483ce4 --- /dev/null +++ b/queue-5.15/alsa-oxygen-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,60 @@ +From 6ebc16e206aa82ddb0450c907865c55bcb7c0f43 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:31 +0200 +Subject: ALSA: oxygen: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 6ebc16e206aa82ddb0450c907865c55bcb7c0f43 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 596ae97ab0ce ("ALSA: oxygen: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-35-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/oxygen/oxygen_lib.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c +index 4fb3f2484fdb..92ffe9dc20c5 100644 +--- a/sound/pci/oxygen/oxygen_lib.c ++++ b/sound/pci/oxygen/oxygen_lib.c +@@ -576,7 +576,7 @@ static void oxygen_card_free(struct snd_card *card) + mutex_destroy(&chip->mutex); + } + +-int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, ++static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id, + struct module *owner, + const struct pci_device_id *ids, + int (*get_model)(struct oxygen *chip, +@@ -701,6 +701,16 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, + pci_set_drvdata(pci, card); + return 0; + } ++ ++int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, ++ struct module *owner, ++ const struct pci_device_id *ids, ++ int (*get_model)(struct oxygen *chip, ++ const struct pci_device_id *id)) ++{ ++ return snd_card_free_on_error(&pci->dev, ++ __oxygen_pci_probe(pci, index, id, owner, ids, get_model)); ++} + EXPORT_SYMBOL(oxygen_pci_probe); + + #ifdef CONFIG_PM_SLEEP +-- +2.35.2 + diff --git a/queue-5.15/alsa-riptide-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-riptide-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..3fbeea722fb --- /dev/null +++ b/queue-5.15/alsa-riptide-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,56 @@ +From 348f08de55b149e41a05111d1a713c4484e5a426 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:18 +0200 +Subject: ALSA: riptide: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 348f08de55b149e41a05111d1a713c4484e5a426 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 546c201a891e ("ALSA: riptide: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-22-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/riptide/riptide.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c +index 5a987c683c41..b37c877c2c16 100644 +--- a/sound/pci/riptide/riptide.c ++++ b/sound/pci/riptide/riptide.c +@@ -2023,7 +2023,7 @@ static void snd_riptide_joystick_remove(struct pci_dev *pci) + #endif + + static int +-snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++__snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -2124,6 +2124,12 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + return 0; + } + ++static int ++snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_card_riptide_probe(pci, pci_id)); ++} ++ + static struct pci_driver driver = { + .name = KBUILD_MODNAME, + .id_table = snd_riptide_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-rme32-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-rme32-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..cd5396f1813 --- /dev/null +++ b/queue-5.15/alsa-rme32-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,51 @@ +From 55d2d046b23b9bcb907f6b3e38e52113d55085eb Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:19 +0200 +Subject: ALSA: rme32: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 55d2d046b23b9bcb907f6b3e38e52113d55085eb upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 102e6156ded2 ("ALSA: rme32: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-23-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/rme32.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/sound/pci/rme32.c ++++ b/sound/pci/rme32.c +@@ -1875,7 +1875,7 @@ static void snd_rme32_card_free(struct s + } + + static int +-snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++__snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) + { + static int dev; + struct rme32 *rme32; +@@ -1927,6 +1927,12 @@ snd_rme32_probe(struct pci_dev *pci, con + return 0; + } + ++static int ++snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_rme32_probe(pci, pci_id)); ++} ++ + static struct pci_driver rme32_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_rme32_ids, diff --git a/queue-5.15/alsa-rme96-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-rme96-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..c719800b9b9 --- /dev/null +++ b/queue-5.15/alsa-rme96-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From 93b884f8d82f08c7af542703a724cc23cd2d5bfc Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:20 +0200 +Subject: ALSA: rme96: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 93b884f8d82f08c7af542703a724cc23cd2d5bfc upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: df06df7cc997 ("ALSA: rme96: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-24-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/rme96.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c +index 8fc811504920..bccb7e0d3d11 100644 +--- a/sound/pci/rme96.c ++++ b/sound/pci/rme96.c +@@ -2430,8 +2430,8 @@ static void snd_rme96_card_free(struct snd_card *card) + } + + static int +-snd_rme96_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++__snd_rme96_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct rme96 *rme96; +@@ -2498,6 +2498,12 @@ snd_rme96_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_rme96_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_rme96_probe(pci, pci_id)); ++} ++ + static struct pci_driver rme96_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_rme96_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-rme9652-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-rme9652-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..1be5fdcc89c --- /dev/null +++ b/queue-5.15/alsa-rme9652-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,59 @@ +From b2aa4f80693b7841e5ac4eadbd2d8cec56b10a51 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:34 +0200 +Subject: ALSA: rme9652: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit b2aa4f80693b7841e5ac4eadbd2d8cec56b10a51 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() manually on the error +from the probe callback. + +Fixes: b1002b2d41c5 ("ALSA: rme9652: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-38-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/rme9652/rme9652.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c +index 7755e19aa776..1d614fe89a6a 100644 +--- a/sound/pci/rme9652/rme9652.c ++++ b/sound/pci/rme9652/rme9652.c +@@ -2572,7 +2572,7 @@ static int snd_rme9652_probe(struct pci_dev *pci, + rme9652->pci = pci; + err = snd_rme9652_create(card, rme9652, precise_ptr[dev]); + if (err) +- return err; ++ goto error; + + strcpy(card->shortname, rme9652->card_name); + +@@ -2580,10 +2580,14 @@ static int snd_rme9652_probe(struct pci_dev *pci, + card->shortname, rme9652->port, rme9652->irq); + err = snd_card_register(card); + if (err) +- return err; ++ goto error; + pci_set_drvdata(pci, card); + dev++; + return 0; ++ ++ error: ++ snd_card_free(card); ++ return err; + } + + static struct pci_driver rme9652_driver = { +-- +2.35.2 + diff --git a/queue-5.15/alsa-sc6000-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-sc6000-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..3d4ff41c4b6 --- /dev/null +++ b/queue-5.15/alsa-sc6000-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,55 @@ +From d72458071150b802940204950d0d462ea3c913b1 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:25:59 +0200 +Subject: ALSA: sc6000: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit d72458071150b802940204950d0d462ea3c913b1 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 111601ff76e9 ("ALSA: sc6000: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-3-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/isa/sc6000.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c +index 26ab7ff80768..60398fced046 100644 +--- a/sound/isa/sc6000.c ++++ b/sound/isa/sc6000.c +@@ -537,7 +537,7 @@ static void snd_sc6000_free(struct snd_card *card) + sc6000_setup_board(vport, 0); + } + +-static int snd_sc6000_probe(struct device *devptr, unsigned int dev) ++static int __snd_sc6000_probe(struct device *devptr, unsigned int dev) + { + static const int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; + static const int possible_dmas[] = { 1, 3, 0, -1 }; +@@ -662,6 +662,11 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev) + return 0; + } + ++static int snd_sc6000_probe(struct device *devptr, unsigned int dev) ++{ ++ return snd_card_free_on_error(devptr, __snd_sc6000_probe(devptr, dev)); ++} ++ + static struct isa_driver snd_sc6000_driver = { + .match = snd_sc6000_match, + .probe = snd_sc6000_probe, +-- +2.35.2 + diff --git a/queue-5.15/alsa-sonicvibes-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-sonicvibes-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..21b4b3a994b --- /dev/null +++ b/queue-5.15/alsa-sonicvibes-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,58 @@ +From b087a381d7386ec95803222d0d9b1ac499550713 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:21 +0200 +Subject: ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit b087a381d7386ec95803222d0d9b1ac499550713 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: 2ca6cbde6ad7 ("ALSA: sonicvibes: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-25-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/sonicvibes.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c +index c8c49881008f..f91cbf6eeca0 100644 +--- a/sound/pci/sonicvibes.c ++++ b/sound/pci/sonicvibes.c +@@ -1387,8 +1387,8 @@ static int snd_sonicvibes_midi(struct sonicvibes *sonic, + return 0; + } + +-static int snd_sonic_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_sonic_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + static int dev; + struct snd_card *card; +@@ -1459,6 +1459,12 @@ static int snd_sonic_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_sonic_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_sonic_probe(pci, pci_id)); ++} ++ + static struct pci_driver sonicvibes_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_sonic_ids, +-- +2.35.2 + diff --git a/queue-5.15/alsa-usb-audio-cap-upper-limits-of-buffer-period-bytes-for-implicit-fb.patch b/queue-5.15/alsa-usb-audio-cap-upper-limits-of-buffer-period-bytes-for-implicit-fb.patch new file mode 100644 index 00000000000..0806594b5d9 --- /dev/null +++ b/queue-5.15/alsa-usb-audio-cap-upper-limits-of-buffer-period-bytes-for-implicit-fb.patch @@ -0,0 +1,161 @@ +From 98c27add5d96485db731a92dac31567b0486cae8 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 7 Apr 2022 23:16:57 +0200 +Subject: ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb + +From: Takashi Iwai + +commit 98c27add5d96485db731a92dac31567b0486cae8 upstream. + +In the implicit feedback mode, some parameters are tied between both +playback and capture streams. One of the tied parameters is the +period size, and this can be a problem if the device has different +number of channels to both streams. Assume that an application opens +a playback stream that has an implicit feedback from a capture stream, +and it allocates up to the max period and buffer size as much as +possible. When the capture device supports only more channels than +the playback, the minimum period and buffer sizes become larger than +the sizes the playback stream took. That is, the minimum size will be +over the max size the driver limits, and PCM core sees as if no +available configuration is found, returning -EINVAL mercilessly. + +For avoiding this problem, we have to look through the counter part of +audioformat list for each sync ep, and checks the channels. If more +channels are found there, we reduce the max period and buffer sizes +accordingly. + +You may wonder that the patch adds only the evaluation of channels +between streams, and what about other parameters? Both the format and +the rate are tied in the implicit fb mode, hence they are always +identical. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215792 +Fixes: 5a6c3e11c9c9 ("ALSA: usb-audio: Add hw constraint for implicit fb sync") +Cc: +Link: https://lore.kernel.org/r/20220407211657.15087-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/pcm.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 87 insertions(+), 2 deletions(-) + +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -659,6 +659,9 @@ static int snd_usb_pcm_prepare(struct sn + #define hwc_debug(fmt, args...) do { } while(0) + #endif + ++#define MAX_BUFFER_BYTES (1024 * 1024) ++#define MAX_PERIOD_BYTES (512 * 1024) ++ + static const struct snd_pcm_hardware snd_usb_hardware = + { + .info = SNDRV_PCM_INFO_MMAP | +@@ -669,9 +672,9 @@ static const struct snd_pcm_hardware snd + SNDRV_PCM_INFO_PAUSE, + .channels_min = 1, + .channels_max = 256, +- .buffer_bytes_max = 1024 * 1024, ++ .buffer_bytes_max = MAX_BUFFER_BYTES, + .period_bytes_min = 64, +- .period_bytes_max = 512 * 1024, ++ .period_bytes_max = MAX_PERIOD_BYTES, + .periods_min = 2, + .periods_max = 1024, + }; +@@ -971,6 +974,78 @@ static int hw_rule_periods_implicit_fb(s + ep->cur_buffer_periods); + } + ++/* get the adjusted max buffer (or period) bytes that can fit with the ++ * paired format for implicit fb ++ */ ++static unsigned int ++get_adjusted_max_bytes(struct snd_usb_substream *subs, ++ struct snd_usb_substream *pair, ++ struct snd_pcm_hw_params *params, ++ unsigned int max_bytes, ++ bool reverse_map) ++{ ++ const struct audioformat *fp, *pp; ++ unsigned int rmax = 0, r; ++ ++ list_for_each_entry(fp, &subs->fmt_list, list) { ++ if (!fp->implicit_fb) ++ continue; ++ if (!reverse_map && ++ !hw_check_valid_format(subs, params, fp)) ++ continue; ++ list_for_each_entry(pp, &pair->fmt_list, list) { ++ if (pp->iface != fp->sync_iface || ++ pp->altsetting != fp->sync_altsetting || ++ pp->ep_idx != fp->sync_ep_idx) ++ continue; ++ if (reverse_map && ++ !hw_check_valid_format(pair, params, pp)) ++ break; ++ if (!reverse_map && pp->channels > fp->channels) ++ r = max_bytes * fp->channels / pp->channels; ++ else if (reverse_map && pp->channels < fp->channels) ++ r = max_bytes * pp->channels / fp->channels; ++ else ++ r = max_bytes; ++ rmax = max(rmax, r); ++ break; ++ } ++ } ++ return rmax; ++} ++ ++/* Reduce the period or buffer bytes depending on the paired substream; ++ * when a paired configuration for implicit fb has a higher number of channels, ++ * we need to reduce the max size accordingly, otherwise it may become unusable ++ */ ++static int hw_rule_bytes_implicit_fb(struct snd_pcm_hw_params *params, ++ struct snd_pcm_hw_rule *rule) ++{ ++ struct snd_usb_substream *subs = rule->private; ++ struct snd_usb_substream *pair; ++ struct snd_interval *it; ++ unsigned int max_bytes; ++ unsigned int rmax; ++ ++ pair = &subs->stream->substream[!subs->direction]; ++ if (!pair->ep_num) ++ return 0; ++ ++ if (rule->var == SNDRV_PCM_HW_PARAM_PERIOD_BYTES) ++ max_bytes = MAX_PERIOD_BYTES; ++ else ++ max_bytes = MAX_BUFFER_BYTES; ++ ++ rmax = get_adjusted_max_bytes(subs, pair, params, max_bytes, false); ++ if (!rmax) ++ rmax = get_adjusted_max_bytes(pair, subs, params, max_bytes, true); ++ if (!rmax) ++ return 0; ++ ++ it = hw_param_interval(params, rule->var); ++ return apply_hw_params_minmax(it, 0, rmax); ++} ++ + /* + * set up the runtime hardware information. + */ +@@ -1085,6 +1160,16 @@ static int setup_hw_info(struct snd_pcm_ + SNDRV_PCM_HW_PARAM_PERIODS, -1); + if (err < 0) + return err; ++ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, ++ hw_rule_bytes_implicit_fb, subs, ++ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1); ++ if (err < 0) ++ return err; ++ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, ++ hw_rule_bytes_implicit_fb, subs, ++ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -1); ++ if (err < 0) ++ return err; + + return 0; + } diff --git a/queue-5.15/alsa-via82xx-fix-the-missing-snd_card_free-call-at-probe-error.patch b/queue-5.15/alsa-via82xx-fix-the-missing-snd_card_free-call-at-probe-error.patch new file mode 100644 index 00000000000..6d968a852bc --- /dev/null +++ b/queue-5.15/alsa-via82xx-fix-the-missing-snd_card_free-call-at-probe-error.patch @@ -0,0 +1,87 @@ +From 27a0963f9cea5be3c68281f07fe82cdf712ef333 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 12 Apr 2022 12:26:22 +0200 +Subject: ALSA: via82xx: Fix the missing snd_card_free() call at probe error + +From: Takashi Iwai + +commit 27a0963f9cea5be3c68281f07fe82cdf712ef333 upstream. + +The previous cleanup with devres may lead to the incorrect release +orders at the probe error handling due to the devres's nature. Until +we register the card, snd_card_free() has to be called at first for +releasing the stuff properly when the driver tries to manage and +release the stuff via card->private_free(). + +This patch fixes it by calling snd_card_free() on the error from the +probe callback using a new helper function. + +Fixes: afaf99751d0c ("ALSA: via82xx: Allocate resources with device-managed APIs") +Cc: +Link: https://lore.kernel.org/r/20220412102636.16000-26-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/via82xx.c | 10 ++++++++-- + sound/pci/via82xx_modem.c | 10 ++++++++-- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c +index 65514f7e42d7..361b83fd721e 100644 +--- a/sound/pci/via82xx.c ++++ b/sound/pci/via82xx.c +@@ -2458,8 +2458,8 @@ static int check_dxs_list(struct pci_dev *pci, int revision) + return VIA_DXS_48K; + }; + +-static int snd_via82xx_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_via82xx_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct via82xx *chip; +@@ -2569,6 +2569,12 @@ static int snd_via82xx_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_via82xx_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id)); ++} ++ + static struct pci_driver via82xx_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_via82xx_ids, +diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c +index 234f7fbed236..ca7f024bf8ec 100644 +--- a/sound/pci/via82xx_modem.c ++++ b/sound/pci/via82xx_modem.c +@@ -1103,8 +1103,8 @@ static int snd_via82xx_create(struct snd_card *card, + } + + +-static int snd_via82xx_probe(struct pci_dev *pci, +- const struct pci_device_id *pci_id) ++static int __snd_via82xx_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) + { + struct snd_card *card; + struct via82xx_modem *chip; +@@ -1157,6 +1157,12 @@ static int snd_via82xx_probe(struct pci_dev *pci, + return 0; + } + ++static int snd_via82xx_probe(struct pci_dev *pci, ++ const struct pci_device_id *pci_id) ++{ ++ return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id)); ++} ++ + static struct pci_driver via82xx_modem_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_via82xx_modem_ids, +-- +2.35.2 + diff --git a/queue-5.15/series b/queue-5.15/series index db9b5d78732..90c96a83c3a 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -15,3 +15,40 @@ net-ipa-request-ipa-register-values-be-retained.patch btrfs-release-correct-delalloc-amount-in-direct-io-write-path.patch alsa-core-add-snd_card_free_on_error-helper.patch alsa-sis7019-fix-the-missing-error-handling.patch +alsa-ali5451-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-als300-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-als4000-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-atiixp-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-au88x0-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-aw2-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-azt3328-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-bt87x-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-ca0106-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-cmipci-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-cs4281-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-cs5535audio-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-echoaudio-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-emu10k1x-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-ens137x-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-es1938-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-es1968-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-fm801-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-galaxy-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-hdsp-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-hdspm-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-ice1724-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-intel8x0-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-intel_hdmi-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-korg1212-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-lola-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-lx6464es-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-maestro3-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-oxygen-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-riptide-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-rme32-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-rme9652-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-rme96-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-sc6000-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-sonicvibes-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-via82xx-fix-the-missing-snd_card_free-call-at-probe-error.patch +alsa-usb-audio-cap-upper-limits-of-buffer-period-bytes-for-implicit-fb.patch