From patchwork Tue Apr 12 10:25:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6610C433F5 for ; Tue, 12 Apr 2022 10:30:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ECB131872; Tue, 12 Apr 2022 12:29:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ECB131872 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759434; bh=JSFV2SpXRbzWgeObP66fU8qa68VU5atl8sCmozSxEwI=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qOfvMVHOu3EYNhJ8wCqnEvGDfjM1upO9bhNpvTFQLvQwSA/fcypVjGEQypReiM2vU NwKzHxWER3gXU66cijc0+tLMLpF9WDu8Q0/iVY5NdtCeYqZr8OluydA8TysKPEhC+q wfEUd07kxtcYeNrTsUl8qKA7QZyRMbcA/7uJFIcg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9D6DCF8057D; Tue, 12 Apr 2022 12:27:15 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36457F80570; Tue, 12 Apr 2022 12:27:08 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 918F9F804FA for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 918F9F804FA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="OncZ5Rp4"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="U5G+ze1+" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 41F08210E3 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GXd+obmk+Uj+MUcS/d+rMx14+WSBkHNjMqA+mb14fHM=; b=OncZ5Rp4R5SYCD8xW+Bhq1PJD9YP6qXdbJRnCayjPlqgjq+MJDJdpd998VbukZYGhs+bwQ ssTGpqFhORATcCQskVni8Vr3tSPWBpicTeMdSV46x0KgmWAAsvf0DkGFfuAN7naihkhMk5 7z13wOsUeZTCAOT9cu7APU5sgeEd+aU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GXd+obmk+Uj+MUcS/d+rMx14+WSBkHNjMqA+mb14fHM=; b=U5G+ze1+SflTf8q0DuMVyA6k6XsYAk/T9OfG756owgH7kMwy+M3u+5dSKWA3DCvF9SUzyS C++ZN1+bdc0rQVBQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 3C8ACA3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 01/39] ALSA: galaxy: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:25:58 +0200 Message-Id: <20220412102636.16000-2-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:25:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60776C433F5 for ; Tue, 12 Apr 2022 10:29:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7D3381891; Tue, 12 Apr 2022 12:28:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7D3381891 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759341; bh=rc4VmqojTlJmhR89oDeZeHx8yoQIetzkdvs00qlQP5o=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=objl21BH+gdDFT8RVDvvZxU/aIMxepktObA9Q8QuKlPJz5oPEBX9nLbWevYttkwTg rmcEfVB4+fclPsDUqsEN1vKg88J82QUTVF6sM+pk5FrQWDr6ZJlAC26GbjFKWNRD+J wxjZu1TlJpQJmL0Vj91h4cMwa5VlvlZ1usph02lQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7C6D4F80559; Tue, 12 Apr 2022 12:27:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E6C87F804F3; Tue, 12 Apr 2022 12:26:59 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 917D2F804F3 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 917D2F804F3 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="JgdyXBxB"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Llz3GR59" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 442EF21608 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HAvtL9CBQW3+bQ9fjuR2abgmkho6eVZM7HE0qmDRjgY=; b=JgdyXBxBwtLv4yT420UuS5Xr9wEwMJbdxzsqXQih7jkGHRV44EjPmeDHK2/o5IlTiHc1hQ 9IKXkzhrSWVO6b0CMo6gIQNExFMopHWA5a3gcHKZQstXvSj4r5O24EtRuGMOhk2u2vgpgE jADHTDJnt8lfXge544qBToqR4FKgB18= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HAvtL9CBQW3+bQ9fjuR2abgmkho6eVZM7HE0qmDRjgY=; b=Llz3GR596qm3jje4DAVFIFn2QVi74+MPzU0wmqUwyWqi97aSGJAU5trUtPCiy8keEcAqA5 gv8tKxuq90mX1vAw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 3F5BEA3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 02/39] ALSA: sc6000: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:25:59 +0200 Message-Id: <20220412102636.16000-3-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560838 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55E9DC433EF for ; Tue, 12 Apr 2022 10:29:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9B27F1833; Tue, 12 Apr 2022 12:28:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B27F1833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759372; bh=X+n/Z3lM/jbnjcURIqe4SQx4wq7LZhg8RlIteL9kHOo=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bTs+bAQkTk3wtuLQdd6D1q9anZPa6GTvQEYiMi6zRJgKxbiWf2yCOn4+3fqTtf1Oy KIqV0NvqxnxrjinydRjXqlXwY43ujVLGT/WvpoNqsdiocNKs/u7xhIxoxKAN70aD7U iE2VVaHzhs54/7PoQ8t5uhiLP4o2lzxYrt52WAeA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 52FCFF80568; Tue, 12 Apr 2022 12:27:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1B31FF80553; Tue, 12 Apr 2022 12:26:59 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DEABEF80249 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DEABEF80249 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Hhs9dRT+"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="o8ALBO8H" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 47B2A1F864 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HrXa9MDXNf6Zu4FLb+MGTqBqWONJpX9+BK4SwX53wqk=; b=Hhs9dRT+JEQDQWfDS+BAQHac9LgkQT5dGZMWpeTAVoZHDYDD+oIppjW7iDHzO8/nJVGerT A7ejP78crIjsx/+TNwaAwMHjNlYrhj6PQrSBsK4jt34rZtqRkxa5JL3+1qVz1jSdoOok3B dutsoZqQbewaceDFcDes3fA0f+qPfa4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HrXa9MDXNf6Zu4FLb+MGTqBqWONJpX9+BK4SwX53wqk=; b=o8ALBO8H0wJYn264LpAugpZCU7I5PKSw4X+E7lz/imvtSIeMyDc1df8Or/XJgUz/fM2f9X q9NmgrOhKBOAHRDw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 4233EA3B88; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 03/39] ALSA: ad1889: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:00 +0200 Message-Id: <20220412102636.16000-4-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: 567f58754109 ("ALSA: ad1889: Allocate resources with device-managed APIs") Signed-off-by: Takashi Iwai --- sound/pci/ad1889.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index bba4dae8dcc7..50e30704bf6f 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -844,8 +844,8 @@ snd_ad1889_create(struct snd_card *card, struct pci_dev *pci) } static int -snd_ad1889_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) +__snd_ad1889_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) { int err; static int devno; @@ -904,6 +904,12 @@ snd_ad1889_probe(struct pci_dev *pci, return 0; } +static int snd_ad1889_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + return snd_card_free_on_error(&pci->dev, __snd_ad1889_probe(pci, pci_id)); +} + static const struct pci_device_id snd_ad1889_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) }, { 0, }, From patchwork Tue Apr 12 10:26:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6C8EC433F5 for ; Tue, 12 Apr 2022 10:27:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 11F6C17C1; Tue, 12 Apr 2022 12:26:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 11F6C17C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759264; bh=NyEov76FVT6UM7O7IpOJPAzf+GugyNwr3F1P1SQndGU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qdbdf5CwGQehuj/BX4xqzNwj+Hbnx8MoUHyhj8XRwFY9dvTBXL4sTZuSeZzdkp1F8 VNnJsJPGxmrT/dp3i/syIaqPeFqKxWOpqFJUS+zGbr4z/M9FhP6TVeJUH/cl8YvQ8v /gu43BEiJY8Ar/uO7AqgfhI1m36cjgsanL1KJJew= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6E9B2F8053E; Tue, 12 Apr 2022 12:26:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 814C5F80549; Tue, 12 Apr 2022 12:26:51 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BFF9FF80109 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BFF9FF80109 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="czCQbi73"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bJPsd6Cc" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 49E1E1F868 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CP5wgP1IcHIcszdlgLTcLAv5vs6xaFTXgSgrdXazqXA=; b=czCQbi73fbh+rRH3y/CYenjezzBUGiBCuvmwNZ7S1vbmgtR9gF1tPWk68TM5JGIUWZ6Sxn 9RndRynlWwregyVACTO2C8OuKi7eUg+dqCkYAUFZ3a/w/CXV3NPO+z8hfqsNYfpakJxDAT E6fkFTutEa+bdm6wtOOfiVsrOe8ICLE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CP5wgP1IcHIcszdlgLTcLAv5vs6xaFTXgSgrdXazqXA=; b=bJPsd6CcsDnMFyynlx4NwXRejbEqrdTo/i91h9Av6p/BmGORUURi9OXeG7KRgECdIYs7Xr dnU4v8JKpG+giVAA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 45109A3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 04/39] ALSA: ali5451: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:01 +0200 Message-Id: <20220412102636.16000-5-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E267C433EF for ; Tue, 12 Apr 2022 10:28:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1FB371825; Tue, 12 Apr 2022 12:27:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1FB371825 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759295; bh=MZrEiqx27iFiln3jWfLnhnErBpRM/W+IsCNj+AU8+pk=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lvVH4qzNctiVaxe53ubXsuJD2LmR/z6F+t4JxJKtDYNYeAfDa1F2ycj0yflf8wosa ks4DIFLgQr47ixJf9oMuGWD/CePl7eKI0T3UcFJ2gz3EEZprxL2Q9Wq0OSSadVe0ii K5avbpQWx/3SO14xgeNc8RHnoNXlz9zo7QSnMz4Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9028DF80551; Tue, 12 Apr 2022 12:26:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 239C4F80548; Tue, 12 Apr 2022 12:26:52 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D5944F80095 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D5944F80095 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DtRZFw5m"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="NawHa88n" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4C9F21F869 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v2UaeZ2JIwkwxcxwzADrycEE5VWLOUR74ly2547YINY=; b=DtRZFw5mVQk/c/P1xEdbkXMDyoHMtVSbty2WjiN5T29yIwQh/hWAyqdDVkSP2LOomZLcyV IdU/sk+pO2bzgqxrw/GUAhEB31Ia04BKblT5RaIsEGG0sFMyJ9sfddzJOjlT2bj3xfwPyv Kdil6+/A4a+xnE2QkpUm4QtxZmcRtd0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v2UaeZ2JIwkwxcxwzADrycEE5VWLOUR74ly2547YINY=; b=NawHa88nV3+Hb+T/r0Q6+fb6+esxCGp8CLH9c9xltxC2kQVDrIF5vrbTGHwqd2KKYp2LcS A1jFFKo03n627QDQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 47FC3A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 05/39] ALSA: als4000: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:02 +0200 Message-Id: <20220412102636.16000-6-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- sound/pci/als4000.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 535eccd124be..f33aeb692a11 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -806,8 +806,8 @@ static void snd_card_als4000_free( struct snd_card *card ) 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 pci_dev *pci, 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) { From patchwork Tue Apr 12 10:26:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3058C433EF for ; Tue, 12 Apr 2022 10:29:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 06013181D; Tue, 12 Apr 2022 12:28:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 06013181D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759358; bh=WDQaYDlUURN1OSjGBJ58GzJyqLJ18Shgceopwe1h6z0=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DdlDg5ER8hNDMrIrhWShUOQ4En3YrkSaHY3+tSG5J6O1zhiGx0cV89R/52H4Pd9lf QS2YECSO/s5aL7OD2fW/LjBG7QHbxMjxWrwILUNyADs5Jl6dX7Uc6qA2Vu0BKGV6U8 P1Nf3T29XFGF9bVmylGsHaVv1aE6rWjnwlrvmMik= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 634BBF80564; Tue, 12 Apr 2022 12:27:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 08467F80245; Tue, 12 Apr 2022 12:26:59 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ED55EF80245 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ED55EF80245 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="yxJ7gNss"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="X3n7aQ+9" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5A9D11FCFD for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vXkaw4IR7n8jzFGw1i9wNYypWy9VxVCqQwfKbf1rWrA=; b=yxJ7gNsshpdSH7rv5i5U80tT+PWEWk9D0pEmLCtNH6sMyWHWvYv8iBGo7y+arcLrosWI09 GIz5LulX/ggs2Wjx7pw/YDwqPjKiw6hMshDZwyiI7H1Yrh15n5gHeGJ+cvl2eWJl0j3J7X Zclk6z/pFIzK3uq0FEnQ+ZUXxRLMMSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vXkaw4IR7n8jzFGw1i9wNYypWy9VxVCqQwfKbf1rWrA=; b=X3n7aQ+9Rqq7VMLSFKq/gvQxnsUaHmNpx3bIbtiyKPlhbTRUERjsSLVYqtJsMncCYj1FAa b3vNBLXRk3y/k2Ag== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 4B252A3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 06/39] ALSA: atiixp: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:03 +0200 Message-Id: <20220412102636.16000-7-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8024C433EF for ; Tue, 12 Apr 2022 10:30:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 066AA1893; Tue, 12 Apr 2022 12:29:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 066AA1893 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759403; bh=7zCoQDPKy6SJJr6nZmoqJvMODzjqfvGKNoJK8s8TEBw=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ReszIpO3z/iQAxGAbMZpBITkFVLS8su+nOJk3IGhqp8mAmLoYO0Fkgya6FWwMFuGq dQc/9bBCI9fUlF13YZNlMl9UqFy4KgxTh7B3xwFNVGOvXT3P0+gAhz3qVfO8xAzQo5 Vm0Z7GSDyVx8ZYyLfMjSwGe4J9KisGwZX5Wrocb0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 876D6F80570; Tue, 12 Apr 2022 12:27:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C8FD4F80567; Tue, 12 Apr 2022 12:27:05 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0F624F804FD for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0F624F804FD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="MKG6Pn9V"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Pi4iSzrc" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5C8F61FCFE for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1oSnYmTO2wDNIX0XradbYUN9BcavbTS3O1rUNBIOjCA=; b=MKG6Pn9VXM8chACHTBQOG3lArcHnB76jWPTwiRmS6RdDgwpD6hl0cmzuRYw7oEMX5Hupo/ 1d7sQnKxRu5mAxdjMwOklHiP8sd3QObowWrPpBxsUI+hY4HzdSKKvAgzO0arERWniT+3Bz y0MJG572KdQsTv8cu/T2Of1uyRm9+IA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1oSnYmTO2wDNIX0XradbYUN9BcavbTS3O1rUNBIOjCA=; b=Pi4iSzrcYRNv4MdYwaLoYer2JoHrxejvVScDk5SazUcz8hhg8aPNElfWn5c6Swqbi6oChR im0uSho+D8p7hpCQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 5861BA3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 07/39] ALSA: au88x0: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:04 +0200 Message-Id: <20220412102636.16000-8-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35D7FC433EF for ; Tue, 12 Apr 2022 10:31:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8331018B3; Tue, 12 Apr 2022 12:30:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8331018B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759501; bh=nd9fTPihYsjWrR2mAE30uKjRkV3oTTEApD6etrwITfk=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=irB7VW37SMTd78QlaMW17aBDzOfU4c/Cn20J8yX/uJz0huviSHcQIQ0ajjeRGjmP+ fu7v+ISNuLIiSegdW8xTcQyyBgQ/wZCJjsISNSVk9r6l7OAQsR8TwQ+J3hSxIHWeLg qyfZ5uuEy1z30qEjE1l0LtU+JyQ2mZs61ezrZBco= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 39F52F805B1; Tue, 12 Apr 2022 12:27:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CB557F80578; Tue, 12 Apr 2022 12:27:13 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6CC4CF8050F for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6CC4CF8050F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="dXHuenfS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="CFkZ8rt2" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5F5A01FCFF for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5n8z4NUNMUz8Es9sbDUg7xURhoYIB3rkSPT0CmMoZHU=; b=dXHuenfSDpAW4/XyBkov+5OUFDIgcvAeV+HnZiHNtwicuFbRyLoO4zW8WM7TUKm0JstPeP C5YFjA7RO9rXazFf1leE3bfT2K5neXbvbUHb+4Jm6OAxlTsmlb7gbU3n5oitrVPjE1UgzB 4W4niemcWJJKL9zqnc2gepSkH/xKcHc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5n8z4NUNMUz8Es9sbDUg7xURhoYIB3rkSPT0CmMoZHU=; b=CFkZ8rt2qD9/3FHP8VJE++eN8Cvgp/ZLMYd/vDS3P5IehfL1GhYzdjL7om4PB7b8eWkyYV Mdd8cdyv4JYFwkDA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 5B01DA3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 08/39] ALSA: azt3328: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:05 +0200 Message-Id: <20220412102636.16000-9-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA2DFC433EF for ; Tue, 12 Apr 2022 10:32:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2AD2D18C0; Tue, 12 Apr 2022 12:31:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2AD2D18C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759565; bh=Xzvhf/aYC4Z1TeMsUmKajqRP18Oe69k8NkkdvMPiwjQ=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OtzH7W+OeT3exIA4cRaWTt8FKw3uLotPBAUTzcbTQD/G5OvF7fZxjGCRCY6GD9GME +7zSJ7NBfUkL9OFe0J+HAn6GKyOJBM/i9eY7YYdrr2sPzaGFUyHNiAuYBs/SihOGGK VJ2no5pGqvpGRy7hTXKew5yuNx72fmVkEX+fVbDE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 705FDF805C0; Tue, 12 Apr 2022 12:27:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6AC4CF805A9; Tue, 12 Apr 2022 12:27:18 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A0EA9F80519 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A0EA9F80519 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="HmLroDVc"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="X9la7p8C" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6156F1FD00 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U4vUzI80Fsu871UkIzaJwpzxt0mWL6fubBleZwUKm+s=; b=HmLroDVcGtlLkyPRY7+5Cr40znRBuLkH2N1Vrr++Jh8YjlvTaXwbCUX9PBQmXtle/qzMkc bWUlh9Ka/DKYEJdw+rSd9NRFwqLt3MTY0P/Dj2JlN4LMcOciS5hVg9tXFOAAOZFtiwO1e2 p2VLWgQG8MFs3jgcBs7ZpLV1R50D5tY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U4vUzI80Fsu871UkIzaJwpzxt0mWL6fubBleZwUKm+s=; b=X9la7p8CyTpOuQcIzpRBod55nM2TnEsJTilmeHCwFDh+y91camCT+ZTyoOGtvUV2QToY4E 7rnsGF/+KItRbGDQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 5DC98A3B88; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 09/39] ALSA: ca0106: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:06 +0200 Message-Id: <20220412102636.16000-10-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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) { From patchwork Tue Apr 12 10:26:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB319C433F5 for ; Tue, 12 Apr 2022 10:31:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E92C918CE; Tue, 12 Apr 2022 12:30:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E92C918CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759476; bh=Kop0a4hq5FEJi3I45TCPhBbOL26Se9/YXC5l58ncIQM=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cWtVETjTVfoOmOLZMYPpr0NKJgE1E5hTpvV+dQRww+ooBNjo4ZMYNti9hqEAz3FOr Df+UgeT/175XRQbWSLZb6usxlOQQ3ex6KmjMvJBtCfrs5BJDwih1varOTAwp1H1K66 B593xwMuPOz1pvBnnyYCJ5+135R4kE+bHA6SizZ0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BBA9CF805AE; Tue, 12 Apr 2022 12:27:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B89D5F80506; Tue, 12 Apr 2022 12:27:09 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 27E86F804FC for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27E86F804FC Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="HsnQIHee"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/svRIxDr" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 63D731FD01 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MAZ9NWjtLiL1pyWL/57uD5CkyvSqLZz92QwDqO+9+T4=; b=HsnQIHeebyXoHn/o2Rtc4jfB36Elh7eGVAyfSUUGYAgV5415NfY4DR1Ms3ghwsVbH4r8JG SoVm37IFfnhb+fc1B14rYY4D0LpYK4E+cjKNkQbhk3wvsWYdozcIr10cVALAXdST6DP8Wy tEChXf/3INAaKUZaFABKJm3xi/H29Yw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MAZ9NWjtLiL1pyWL/57uD5CkyvSqLZz92QwDqO+9+T4=; b=/svRIxDrnUmiVsnBWlp98C5iN8R0nHWxBEvkzlPVt/Blg+dVHfm3C33ocxFWCxhDrkxWhY llfLRrTd8bvojADw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 607E0A3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 10/39] ALSA: cs4281: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:07 +0200 Message-Id: <20220412102636.16000-11-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 */ From patchwork Tue Apr 12 10:26:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560010 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A5AAC433EF for ; Tue, 12 Apr 2022 10:30:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9C81A18B6; Tue, 12 Apr 2022 12:29:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9C81A18B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759449; bh=iqh48JKpIai8r6FEqZ5erUd42kU8XJHco8YUTKTZOF0=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mXMULfJdH3G+b7nrMIgLHdKYs9XIaFXuFZYixge4j8ZLkuhh4JQr4QSMMFAbv7S81 bkCCQhHL/Jn6Q+fah6ofzlwtPFfz4aCa+VQGtVdykuKsL/ZVRivot/bqlJOrYNndwF tF6k1yYHbm+jfXdWH6e9HdMZg3QGuRnAVOFyyli0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AB4CFF80507; Tue, 12 Apr 2022 12:27:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 652E8F8056F; Tue, 12 Apr 2022 12:27:09 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 36872F80506 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 36872F80506 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="etaZ5viv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="1eLsLsle" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 66FCF1FD02 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qVAYNsL7ePHzsADD4iBWp9Y0yaUujcJib3/ATtFcymE=; b=etaZ5vivRTvWDtN5TcorckSnikFww9GMidzEMkY8jzvIIkqsz4PogLDQ/1MfCxWzL7H/G6 GjrknLqIYzZ7h43HRwlofCNq+BHpufN3Sh9bPlNufsZl4u7d4vfZckjq5aT/WUt/xe7TMd YmHuJ4I52xRQWyiJfSxlcT0HNPskLac= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qVAYNsL7ePHzsADD4iBWp9Y0yaUujcJib3/ATtFcymE=; b=1eLsLslemUQjVCU9+KHghiZX6xs5IJu3nJBq2IK+k0BG8R+9sejV5soA4+o8zxDiyH+CmA COLeo0LU+zN74rDQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 62FCAA3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 11/39] ALSA: cs5535audio: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:08 +0200 Message-Id: <20220412102636.16000-12-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B1C0C433F5 for ; Tue, 12 Apr 2022 10:33:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4B175190A; Tue, 12 Apr 2022 12:32:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4B175190A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759583; bh=//B85Fukqm0h99gHAz2PTXhd/HruhQ71/ld7/X4s70I=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AI0ecxOUzUFhp1O7Li01IseHChtUwboq3kovoQbewyzuM3RebDhMYFt+Yb6NV0Ytb cWkcbSE07gEfFGUdovKxirXTymR7H/C7lqXx1J38neTv0Oo/r4lw4h+v8+24bQDBdb +ARjhX2VWos2rhcIpjiBt5fae0Fi3sh9I+CGnVA8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 70754F805C2; Tue, 12 Apr 2022 12:27:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 25F5CF805B2; Tue, 12 Apr 2022 12:27:20 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BB96EF80528 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BB96EF80528 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="l05bXXzS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="x6C8t+B5" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 69DEE1FD03 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tkA/7AnGhP1AnWmdTMelHjwaMkwBWhF79/9Dm7ESkXM=; b=l05bXXzSZQlCW3qN27GDSH6X83OmiZ3U+qmEa6fSok2CPabQwLz8tkUGdDPwwsrmXS0zoK arx5klQ/Sj6hC2QKUSnOQ/zBNLRTuKuQjyGHgFCAf8Cx+wm0V/YaLwg+hxo4P34X7qXgAX KKonYlO2lNECh7RdlvllgUMZCeH81d8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tkA/7AnGhP1AnWmdTMelHjwaMkwBWhF79/9Dm7ESkXM=; b=x6C8t+B5VmAxciFUL2cRqSQN9n/aOGOCuyjR6yp3NLLC/kB6Qs3Dm+3PLD2+ON1WNXhCrD uC/+EhhqlEIKJQDw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 65F12A3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 12/39] ALSA: emu10k1x: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:09 +0200 Message-Id: <20220412102636.16000-13-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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) */ From patchwork Tue Apr 12 10:26:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E168C433F5 for ; Tue, 12 Apr 2022 10:34:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BBAB7191F; Tue, 12 Apr 2022 12:33:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BBAB7191F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759686; bh=fU/PKo/7r82NvQhtUI63rLGVfjKDV+FdW5xsIXiBbJU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rrIoqmbmBgLYAWMpK3C6n9C9VrmVtm34cTwf8FxCzjCUHHnDHh8JYLncU4BJAh724 XOsUuTwkXFyVHK6OKhReIw2Irt0oq+SIngGmnq3yV3DrEHM240iLILpbLPRMmKIZ0A +RdSymkZxMJL2Bm3D9WaiHMV/vfQNgdSubjjq384= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8C6EEF805EA; Tue, 12 Apr 2022 12:27:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1C08EF80529; Tue, 12 Apr 2022 12:27:26 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 18A39F8052E for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 18A39F8052E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="e4MgCfJp"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="maPN8T4t" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6C9DA1FD04 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hV57e+ljIu6k/VDx9DqZW+flcmu+afnn7VNlA+nOqT0=; b=e4MgCfJpI0VY+pFxI23ul5q3dyElDu9pP6tK05ex3zcHAGlshxkgnVsZviEulocvHFXbBT JMGi/+AlVGd9urLvRWrK2vZtGeKhJYPrHsU5DlxccW1FjZ54QbFi2yHdZvOTxhvcjkgeSX mfJ6OIm7mQoXY/ldyberNjhO/8fvDqc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hV57e+ljIu6k/VDx9DqZW+flcmu+afnn7VNlA+nOqT0=; b=maPN8T4tIylGorYxGGkZWTlTRbq4ZC/2NtIY3jfMSgDndLwq4gq3BZohlvtWC7jP/1l4UW IfQKrWeQ6TG7ufBw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 68CFCA3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 13/39] ALSA: ens137x: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:10 +0200 Message-Id: <20220412102636.16000-14-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1FF17C433FE for ; Tue, 12 Apr 2022 10:32:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5CF9316B4; Tue, 12 Apr 2022 12:31:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5CF9316B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759522; bh=4V4OaMc4XUimb70Z/tKW7wils5+dSwNUDQqeTlOefJc=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=t6wWcukKyGOImCf3BOZEXV9zypAKFs+zJscLbhUbftM4EHxwZlQIF3AR8RQENA85Y +pMfS7KyZeML9iA2N5bR7AVUm54dYgNHXv6KJhodPfYp64Qu6d5d1+Eo+JeQCTDRwW oCLUlzbFZ8zq/KDNVZI2KnTCkGT13PrIyXCqQRHI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E9505F805BB; Tue, 12 Apr 2022 12:27:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8A31CF8051A; Tue, 12 Apr 2022 12:27:16 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 71CC4F80507 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 71CC4F80507 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Tin/s4L9"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="C8Hi9AUQ" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 703E01FD05 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mP5YzvHhQusfxGH4trPRuyh4X0ylXt+ZURJV6km1EGg=; b=Tin/s4L9sHs9rvmJfpNSR6nXYUN7ErEKalzHYToxXy7UejVAq2ifcdnx/K/nVGm4idBE6g ikzFPatgoBhT6ZK9xhMLELZQdrNBdFbK4oeDM0pzrgpG+Cz7qVV0IyOU6V3AnydnhqCyGh WYxd7M+GUUe8Ga0RRnswbzekJ1aO4NI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mP5YzvHhQusfxGH4trPRuyh4X0ylXt+ZURJV6km1EGg=; b=C8Hi9AUQZOzaTnnPqb1WwXvLMtAjJOKlHlI1GDgeXhycLDQ0gCjPqE7s6XAQx0cDUQBiJL agPSVvpDNnQ7q5Dg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 6B973A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 14/39] ALSA: es1938: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:11 +0200 Message-Id: <20220412102636.16000-15-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560012 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 594A3C4332F for ; Tue, 12 Apr 2022 10:29:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9FBEE1825; Tue, 12 Apr 2022 12:28:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9FBEE1825 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759387; bh=n+XlZ31wFZ5p6qYeFXefQ7sAR5P9/9N3AzznbNHvgog=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SAVKzlTVaGl+2X6/32WcF+35BDWEluaxn13e31r+Dn41XZZ08iTmMifgcOx/txg2U SvQw809/VB/hvYLnL/MvFVGqa+7bXEJO3P8MdN4yK9MH7Ms8/bx0NuKtXva4Yh2aq0 ZZrPva/c+nhYvY9XvmU9htFnk+MKEibPGUipjnqs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 35F76F804FC; Tue, 12 Apr 2022 12:27:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64362F8055A; Tue, 12 Apr 2022 12:27:00 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D8D75F80154 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D8D75F80154 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Bn/Fvk/4"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bRUlmtAN" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7393821609 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JttCb+GFYFUhl0O40aK8jtcGIbCvbvD/7/s2AYKXmUA=; b=Bn/Fvk/4tn0/hgEG0Uiz2YjneVnSFA82NEYE5NUCkOOX3VzrHipLT89qzFewInKz0RD2XJ ZPy90A1HdoQ5G/RNGThnqx0LKTuyq2WCiL4msB92tnkWQpGYcFS8p9zBTS/qcmvBvnY1bB EpNlwUAChtfugMCPrTtCEBzORKHxOCY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JttCb+GFYFUhl0O40aK8jtcGIbCvbvD/7/s2AYKXmUA=; b=bRUlmtANZv+dIvUorBoidAlrRyQnNcCvkwnSv4amb1Cjf6cc8EanZyaO/pZtJ6NbYf8ur1 Oz0FW9F4Fqf2PWBA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 6E562A3B88; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 15/39] ALSA: es1968: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:12 +0200 Message-Id: <20220412102636.16000-16-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BDA3C433F5 for ; Tue, 12 Apr 2022 10:33:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9B1C91910; Tue, 12 Apr 2022 12:32:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B1C91910 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759597; bh=KgnKYQN1NBErWZfx8oulLJCih2HJ5OxRfnqTpYRLhxw=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cNDiGGN6F7Yji/259HHqWr0LeiaTSn86GCKDBL8SZHt8Mu5R90VC3u8CLBMjFKzZn 9zvRkSEECrsYwRpwxs0f3FMmBHHiMmxPDm0v+twnEaLtkRUZR1r6wGzfpopVtse6SD bGr9cFLtOfhn+SSty2mxgHeOO1+ShsxsM5RwxmFg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 363F3F805C7; Tue, 12 Apr 2022 12:27:32 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DDC52F805B5; Tue, 12 Apr 2022 12:27:23 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A3C43F80527 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A3C43F80527 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="oFToAMZB"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bviP9ZGs" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 743D21FD06 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XuhCRLRYjLB3evYOFD8r7tVwyNZ3T1P/oUtkHvEqbjE=; b=oFToAMZBMNEoDvP9/15ndNXz+mfeygQgNDELTImM4cfBuyfgE6H5oN/X71uwQJgGs1w1yh I1I/f4weKw/przVaQLoSm5ao6Itcdzo7wejINEiW7eEcifPqcCw8oRWSwPPowRF91VEtrS Vz0rHqV7dL+1yO00fQVlTCsNYxBmzTU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XuhCRLRYjLB3evYOFD8r7tVwyNZ3T1P/oUtkHvEqbjE=; b=bviP9ZGsiYCWe27jtoPHc30DAOiuNNMD/Dci4v7PMbDWflhgEn4zWzyp9QLY9+RHOMm114 11EK8CxEX6FIDZDg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 70E05A3B89; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 16/39] ALSA: fm801: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:13 +0200 Message-Id: <20220412102636.16000-17-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12CFAC433F5 for ; Tue, 12 Apr 2022 10:28:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4B1121831; Tue, 12 Apr 2022 12:27:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4B1121831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759315; bh=MWcVV1iW7QzzIRuGok5yDD2fRZRZbuFBw882eM5UPWI=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OhPTTPDAZqFTnp/f8nXwjMDcZpGzGGuY1LXGOZ4RFdE8ahGBVfytTHPrHx8GEba3V 69bnA2UJ2mQH3uZQNuN55d2udvo+RMQXySfZZ3et1UADozdvVEEocrRVfYCMpJNV0h 7Kgt2uyI1oWgsRFQ78Z1yTtZxPrEnZQkzYVxB5Jk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5BD4DF80109; Tue, 12 Apr 2022 12:26:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 09667F80557; Tue, 12 Apr 2022 12:26:56 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 152A6F804BD for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 152A6F804BD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Y75jpFmh"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Waz79E6f" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 784A92160A for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=59Wdmg+mEJVHHk9RjGjKA7T+5t6Jft2vj18iZEJ62CI=; b=Y75jpFmhoAA6RUXOXxORNlNjjj12J1AXg1uXcSTDsYJMFMMNBccYxHPwRhQZvZEKljIuY6 zqNXIrP0yMcKnhsdT1hgBnQEcuZ1mjjrl8w9Ax/gKBljMBHaik+exjem1a87uVlWe/a00n 9hFGuhuIFeP+o0pBZkx4KPoj+J9dLzQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=59Wdmg+mEJVHHk9RjGjKA7T+5t6Jft2vj18iZEJ62CI=; b=Waz79E6fIofmdJby9/2059a1FUsv7vSs3Okl60C8Um50NAQnVdaejz2dK309v/NtTNPfUN c4C6PjtBNTjxC6Ag== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 73529A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 17/39] ALSA: ice1724: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:14 +0200 Message-Id: <20220412102636.16000-18-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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) { From patchwork Tue Apr 12 10:26:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560014 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01650C433EF for ; Tue, 12 Apr 2022 10:28:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3B2081868; Tue, 12 Apr 2022 12:27:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3B2081868 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759324; bh=njAoagun8JDqCoy9wCTL9urIYtZlSomJ+5b4yeU8SR8=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MYp9lyp7LfpyEXjdH7FBmixRTlv12cWkeX9l/nsCnr7biLvRVv8nvKF9ZOfGugtKg Sw9/8thCQ2L8/t40QvJwh6edaKERhVhfFMv1XYdwci+YZsuac8Z7xaU/yl5cF6VPsf EYTuWC6FddhMPl5NOcsPTVvDaZtJjak4grf8FWU0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 19583F80245; Tue, 12 Apr 2022 12:27:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 99BF6F80559; Tue, 12 Apr 2022 12:26:59 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D9720F80134 for ; Tue, 12 Apr 2022 12:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D9720F80134 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="KPMHiHgU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="UZYL9lrN" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8602B2160B for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xTh4slqrdHVfRLdHGuV2xKtzClg1VRRWXHIGxbCMQtw=; b=KPMHiHgUtNZIEx9KaVxDK9fBOk4bz68SlOeTQbMad0lSV7LS/JM5rHLZk67LulcBd+AwXn k56VvfE57uDCOaM3JHZsm4X/Jh/LBjdScCfUaM1V4fgwCNuv8L/h3eVpFDJcLCXHv3nY/n oVj97sGJP/yobS9gPAXkwP72ZrrGNJ0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xTh4slqrdHVfRLdHGuV2xKtzClg1VRRWXHIGxbCMQtw=; b=UZYL9lrNF9CL42OhPa0sr5paZiBrnwGb2EpxeiBxhyBmycSXeiRfFJOOYEWSwuiAIIPwTy rU8n19kIFzYJXHCQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 75E6FA3B8A; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 18/39] ALSA: intel8x0: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:15 +0200 Message-Id: <20220412102636.16000-19-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9367C433EF for ; Tue, 12 Apr 2022 10:34:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 33428192A; Tue, 12 Apr 2022 12:33:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 33428192A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759655; bh=abiV4eZOtOqGGUTImRsd5gSBq73wopSUzIQgS7TVrJM=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=m0ctVkkIyVo3/6tdx5JwNWDdoxepVOidt8G8oAQ1bnTkLX/DkCIEv2foQ4/0K9BnS VrXO1a1Dciw2I2/lP0CsVhKvF3oEqZyERlnSi9bAiHJ8Kqk5cNpihkKMQCs+U4QFxY nsoi4lr3+OqycFmilZIERTYPSS3wZQlrNNYjEwqk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6D103F805E2; Tue, 12 Apr 2022 12:27:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E48F6F805BF; Tue, 12 Apr 2022 12:27:26 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E3D01F80529 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E3D01F80529 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="bP7fwzqZ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="387V+jgc" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 884DB1FD08 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LT2NdBvR7mFcIT4bEWJvmhCGWGCq3StTR1tlVTtsxMw=; b=bP7fwzqZpI2utvDJGSZy07142EBJM/jlVd/QSa1vSlkNTViTTZGwsFY9SXQkIvvbURkpQP Oh4h54xrzJp71JAgMf71/Gt1R6IkK0OGVaSiIhE68qIwL3yJDPWRIn68GPwLgz37sDg4Gf V+kjzifhKjLhCWAhzdTvShiCoGAIeQg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LT2NdBvR7mFcIT4bEWJvmhCGWGCq3StTR1tlVTtsxMw=; b=387V+jgcOmQuKghUkCQnLmryIWF8oItW+NDdIuX+721ym1ooF1hKE9avRH8VatvnM7yzHF 6A21RQ5Sem+zcKCQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 83B1CA3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 19/39] ALSA: korg1212: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:16 +0200 Message-Id: <20220412102636.16000-20-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 = { From patchwork Tue Apr 12 10:26:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 559999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17ECBC433F5 for ; Tue, 12 Apr 2022 10:36:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5FE5919FE; Tue, 12 Apr 2022 12:35:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5FE5919FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759809; bh=OB7gwpmcad9oa2zufju3DhI2AdKE/+f35PGR4WVuirU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nS3lx9WLeH8K83vCPS1VYjeii+yeEzVCNK6S8oRy7T3Wr+WsIZYiKVzF+cFtiZ8J2 tTwPoe8VJbLw75lZ1Pno6M3fuL/FZHWE9DCHU14RH3Vf/Qx+Tub/fSuglmFOaOjwbp Kh37WHjMJLd2Zx8K0vzketk1UP3oiN1vYgzUZg0k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 29A55F80602; Tue, 12 Apr 2022 12:27:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 68AF0F805DA; Tue, 12 Apr 2022 12:27:38 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B9840F8053A for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B9840F8053A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="L0jP0vTU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="w3gRtdxl" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8B5DC1FD0A for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=buMcmmJzhqu1UdiqUmwmTBorrFxVZzCqA1OBSak05m8=; b=L0jP0vTUwtpvko70TW1kwVEx4XnBH+YqO8qxUJ5PPiWRVIb9E9HeQAaO6DHGg+2q7c71Ux b+wKg0dlK5bEWSPIGdXZ/Lm/OI/JBh4cxZCeJ8k3s+ZdQMKv+JI/9AOlU8Rh+xQjBLFHRr VejxZu8XLXX5gFHEuFE9+NVok3xcDrA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=buMcmmJzhqu1UdiqUmwmTBorrFxVZzCqA1OBSak05m8=; b=w3gRtdxlFk3/q5Yp6KiocGntqcrLhd2jLpUIjdV2dxuqk5RRUa7rVvwzU9SAMc/WNrUcP+ PXLmmt3ubKikjWBw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 86AD3A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 20/39] ALSA: maestro3: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:17 +0200 Message-Id: <20220412102636.16000-21-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D30BC433F5 for ; Tue, 12 Apr 2022 10:35:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D7E49190E; Tue, 12 Apr 2022 12:34:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D7E49190E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759732; bh=3/tBqllMumUMNvb0OQSAOSRZ0nicJpO2rrUWHSPxtO4=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dTw2WSxz6vRPXGMHax946nenqk0q0n3gfrJNJaHeH/qA/qXVhjkhDX9KKTfePbY40 xAQPc4LRGwMUGj2Ob2xED1HyusTXYU5NHYsUgKgqYf4fj7sy7kHV2KA9VTk3kGSVUb hidTqpy8EaUb+IQhtxLHEXjnAdU4mflm3/0/T/ig= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32227F805F6; Tue, 12 Apr 2022 12:27:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B02C2F805D5; Tue, 12 Apr 2022 12:27:33 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5D9CDF80535 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5D9CDF80535 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Nk3h4inh"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="hTN3Ilyw" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8D8421FD0B for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxQ8QNdZr+AhJ2KjuuBfUnCTq6S8w0MU9hTosNC5+54=; b=Nk3h4inhhptucaVsT30wDs+pckJUntkB1oNUjldm16tQ0PeJz1eEy4QHmVTMkO+29PG+HW z6Slx7qBGZ5JYjiHN0iSbDj2fc8cBLt2FOt+wqGZ0CocJQX1pnucx5sUZKMc23abGdXKBa EZuMOMHwMRnnxd1cLpMCXHcHyDdv3wM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxQ8QNdZr+AhJ2KjuuBfUnCTq6S8w0MU9hTosNC5+54=; b=hTN3IlywRrPizyEaZqCBGV3lYA46MTXHJaxNGFVFXluLXxVoWZ52RNpZMudqGQGl8AO3tz erRbKvui2lnU85Cg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 8986EA3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 21/39] ALSA: riptide: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:18 +0200 Message-Id: <20220412102636.16000-22-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 405C0C433EF for ; Tue, 12 Apr 2022 10:36:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 84F6D1A23; Tue, 12 Apr 2022 12:35:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 84F6D1A23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759779; bh=xdv3UulaSh0VJ6lnjc6r/xgs2OwWsJ/jTY92CpelV98=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tPoQsUKsHEg3Jmadcs2ZIrhBXfYRwIi6uJI7S536Vp3m//2SDGybIKeq2ZZgobkQP 76Otky5MiW8VnQLF7knWW6ERk3LCYySwxV72KyfVhAKrxFcTEGbrhu9Fs3I2AHnOmH sVs+3smU9B6DLYOn7wF6RuKN5X0U45hken+ge+wc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CFE2FF805F8; Tue, 12 Apr 2022 12:27:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D382BF80539; Tue, 12 Apr 2022 12:27:36 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6F3BEF80536 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F3BEF80536 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ZxE97iFF"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="R0zvCYMe" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 9029A1FD0C for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EOUXjo6Ac9NmInUspviFoMlTTSwXxyGlBvnZBLBywYY=; b=ZxE97iFFCNMRCptk2RvjmEpIMcyivJhsJcZ27mbSP3vn28F0/5j5BxWORqz1U+FqZyrLu6 IjAQiblw2l8d82AzieWilGnx1BR+jQExkyA+5W91suFXVSavXyfCRps3WFasQZ1itXtw6Z KpDX6feyYfVd0x2jakvxqu8fXJP+Wwg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EOUXjo6Ac9NmInUspviFoMlTTSwXxyGlBvnZBLBywYY=; b=R0zvCYMeAB8jEx37ERM3pIBGy1aGB9/z6gpJnrrfujjPUBrF0J5UW5quoq1J3p6+xe99K9 X1ePKzYkpIs4kiDQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 8C8D8A3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 22/39] ALSA: rme32: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:19 +0200 Message-Id: <20220412102636.16000-23-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- sound/pci/rme32.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 5b6bd9f0b2f7..9c0ac025e143 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -1875,7 +1875,7 @@ static void snd_rme32_card_free(struct snd_card *card) } 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, const struct pci_device_id *pci_id) 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, From patchwork Tue Apr 12 10:26:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63CF3C433EF for ; Tue, 12 Apr 2022 10:36:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A907B1A00; Tue, 12 Apr 2022 12:35:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A907B1A00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759763; bh=cw6cyQiAOI1f5WdJ6HKpZ5o+o16YfgCIIEyHqppGlN4=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UZ8rtCteNchxTpIAlwD/ewau7AYa2C98hBCgQ3TjL4I+8CT2Aq72FMzBbuP/lCiHM fDogqf1PzCYahmITCac0A5W+A9OnsB3wxGIE/i8hDlSMiyw+jVc+qy01DWhw7RPj/k KCL1jVBpkzTSW1Z1Ov1cgQfKr+T0PGWxTO2hbA44= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 12440F80544; Tue, 12 Apr 2022 12:27:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6942DF80537; Tue, 12 Apr 2022 12:27:36 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B95D1F80539 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B95D1F80539 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="f0OF4FOU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/aL4Se4w" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 92B1C1FD0D for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m5n2ayn9s6NGsJYdLXtRUgZruzVN1K0m3AVhEHXupUM=; b=f0OF4FOUAX8alzm4G3GJsAy3AJqMjhlNYGYlmU0UyBiL0jEtTMBRTupHdUGv3QW/BaC2rF krZh7YoAh4SYD7Z5DjfqkyzzcwbBjzYtHBfluKIH5huSIF+huWJK8n+CfysvT7t4e0EsvF Q8qfeKiHLmwi0J2RQ9x/fHkNVUmISBc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m5n2ayn9s6NGsJYdLXtRUgZruzVN1K0m3AVhEHXupUM=; b=/aL4Se4w+WrPlF4FP1DloyqyTpkYAEqXNEtFh+WGHXNUwdnHRZaptIdXvXnkNk0vZ6nFpb eFpe/ZSpHreADwDw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 8F284A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 23/39] ALSA: rme96: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:20 +0200 Message-Id: <20220412102636.16000-24-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC3C3C433EF for ; Tue, 12 Apr 2022 10:35:18 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3DD751906; Tue, 12 Apr 2022 12:34:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3DD751906 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759717; bh=7LPNR6AKFc7mv87Ep768tv2/rl9MHd7CK+0qfeGUmIg=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EkA5/+pbaJgG3St6Dm5idF2tLeORgvIVPz2BFvr+fTlks/hdPDwkmvgTnv+eC/0W/ pwoYog3cqzEWCddax3zeRlN1tJdU2Q4DO1Ncw6CEr5EDCIhZnYMxEl/JZNCKLOj4C3 T8KTJThQBMB9UjXlfw9C9ZrGou2n+DSZCxJB42v8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 99640F805F2; Tue, 12 Apr 2022 12:27:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ED78EF805D5; Tue, 12 Apr 2022 12:27:32 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 804B6F80534 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 804B6F80534 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="YXnkrg9e"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="eaFJ+j8z" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 958781FD0E for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CUdK9E+J+FHROcXAcHSmVQsgvYI2N0qjgr12mGva1+I=; b=YXnkrg9eQJrjwdfLevxCrpbEoroo4KZWbmUDnt3cilFy0lWyBzD+h+/ug0gN0K3FYWrjhK FWPjP3A/ixciCS6sVPu4IBN2E3O2QRlKQ78CvDBZxIqGad0BeBLaPxJ8BK71XC/IVTu7I/ /0eXtvhavzb+V5UK01xzCU8p7gZFq+g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CUdK9E+J+FHROcXAcHSmVQsgvYI2N0qjgr12mGva1+I=; b=eaFJ+j8zSaNnNerqM2vYGLUK5wOlS9Qwb1djp6K+kgeYRqyNbCElVV5pNVzrytBJ85GmBm 2H4tsLBXVPzqEXCA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 91C72A3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 24/39] ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:21 +0200 Message-Id: <20220412102636.16000-25-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA963C433EF for ; Tue, 12 Apr 2022 10:35:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2403519E7; Tue, 12 Apr 2022 12:34:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2403519E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759748; bh=Tr8ZspZh5zuasphvzs/ZUFLjLdR7S6mjyF/LcZjQ9G0=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FeDnldbwmMX9Sg7gndKqxipFy6GwCYd27/1lxryBo8BwO34/AtnpL83CDhic9YD/u Ra0mQhp6e9y2R1hWwTjWJ4MwhvXgdMv05Ngnv3fPXpSh6jx34NmxLX3rVbicR1NO0n VshGk/ZTNKQBx0gnIknEn6v2StUjQISvnv9hazEw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D265BF805FA; Tue, 12 Apr 2022 12:27:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D3821F805C9; Tue, 12 Apr 2022 12:27:35 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B0C2EF80537 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B0C2EF80537 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="BrAXuGe4"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="IgNDNLb5" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A3FD51FD0F for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dd7/QsxKov5Wb3F3VhBS0FpeLv2uhXIS4qee59ep5g0=; b=BrAXuGe4EXJKE/SGYFkC4uVT9G/ABGZzzXGkFW6n47UFwHNZNukC0hon/g9RvTtekbrfY0 YU6Qrtuszgmb/jdtTL/ybB7jvZjCG1hpnTxdabPCULeYd3h9gK9OaxJgV3Zm80JMHvQorE /MK8xSjYGtvxyubetXyq3nBoGqGOy3g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dd7/QsxKov5Wb3F3VhBS0FpeLv2uhXIS4qee59ep5g0=; b=IgNDNLb5U1UqGOV+pPj2aIcFBI/P8cmjl/BQnEyVxxhXgCs9clj7xFKW4z9WGxKZuY7bA5 roHyOL+NwAtPBkBA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 94B9AA3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 25/39] ALSA: via82xx: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:22 +0200 Message-Id: <20220412102636.16000-26-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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, From patchwork Tue Apr 12 10:26:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D41FCC4321E for ; Tue, 12 Apr 2022 10:36:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 29EF41A3B; Tue, 12 Apr 2022 12:35:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 29EF41A3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759794; bh=MsY1aGfooyq3028Mm7Y+OwSl9586oxokQLZ9hQSyoFM=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tgxUgTplgiicmtQsUWXD4M3zm3MxT/G3uEO+cKRpaJCIMVDXB/Rr8U11+E7aatWj/ 58egUvWO1YxJaPNSMdI9ZopwUIR2ptTQiFVUFLpP8HsWtbeBSt8zj7XH7r3nzGfwMo xRxwQtHqG2Z5vrQQvkfTN2Pz9x+itLuQ3wl7DAhk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6BE81F805FE; Tue, 12 Apr 2022 12:27:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5625EF805C9; Tue, 12 Apr 2022 12:27:37 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D484FF80538 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D484FF80538 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="N+By8BmN"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="eotnhOee" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A655B1FD10 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ds/OLCQRsKzgyeWzoj0D/srGcquzUMGCV9IFeD2ReEc=; b=N+By8BmNXyaY0M3g0IOMGWyth6majiU7HlJQrNIoT/nuhdU+k7I5dW4lQugsW13AUIXW5H N5nLPMHR6CpQ5H6LL+ZShr65hz3ThOURvYhUK6qx/oI6csszFh+tjtck1tbx0eoJx0XVrw 4PhXJxLG3kJk569n3O6OKqBiAcrseIo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ds/OLCQRsKzgyeWzoj0D/srGcquzUMGCV9IFeD2ReEc=; b=eotnhOeeXcyqqACO6IlQUquqtfXa6PT2Jjo0fCBUfEDV31bIfmBd3JzxuFfZz5NNwa7WPJ Jise2LKNyuwbtLCA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id A2A51A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 26/39] ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:23 +0200 Message-Id: <20220412102636.16000-27-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- sound/x86/intel_hdmi_audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index b00634663346..0d828e35b401 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c @@ -1652,7 +1652,7 @@ static void hdmi_lpe_audio_free(struct snd_card *card) * 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; @@ -1815,6 +1815,11 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) 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) }; From patchwork Tue Apr 12 10:26:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560828 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4AE57C433EF for ; Tue, 12 Apr 2022 10:35:00 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8CD7118C5; Tue, 12 Apr 2022 12:34:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8CD7118C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759698; bh=nXPT4FsOx4P9S+mCoAJsjODqLtzWta+fW+65FNk0X2E=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZrLRVrsk1v/0jd19SsQ9uWfr/chtYPp1ypfUrYPXfcNvLX/Wxj+l6ZaERYNHP6yS9 xvuGRR/Z6rES2QJglIL+ndUMAhrnKANRVfcd7IQeMLdN1VWrhQsHobEs48/eD4P7nW RVymZJecGkRgbCA6H6cbk8e1FqyUlosHVd48a4Oo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1ACF1F805EE; Tue, 12 Apr 2022 12:27:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9B25DF805C5; Tue, 12 Apr 2022 12:27:29 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0376CF80533 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0376CF80533 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="n8UW825T"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/RF7fEj8" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B5CAC2160C for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P9363mVAO43lU2rEf0MaglZeHy5p2XxAOfQpKlRDPpk=; b=n8UW825Tu7l6ABF4mJA9muurnC5nYB0F4nQvsEaVdatuwgRvwHBsKnnPbs+CmwKm+QDa/m hcR0sTB4NbC6TANdKAMkp/Yk+ds/857xUO5cEEmBB9wqZD6TzSAo8X6KqRsWi4AsSWRYGE K6jkzQKWwalayj2A4978px9kTg0DQX0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P9363mVAO43lU2rEf0MaglZeHy5p2XxAOfQpKlRDPpk=; b=/RF7fEj8naJccB8PXZvMyxJSn1WNh6x3pdPipWWj4Xyu03e27D9cCKAq1OCPc3ajO6jl4p Xvz0oINTtUXXqmAg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id A57F6A3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 27/39] ALSA: sis7019: Fix the missing error handling Date: Tue, 12 Apr 2022 12:26:24 +0200 Message-Id: <20220412102636.16000-28-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The previous cleanup with devres forgot to replace the snd_card_free() call with the devm version. Moreover, it still needs the manual call of snd_card_free() at the probe error path, otherwise the reverse order of the releases may happen. This patch addresses those issues. Fixes: 499ddc16394c ("ALSA: sis7019: Allocate resources with device-managed APIs") Cc: Signed-off-by: Takashi Iwai --- sound/pci/sis7019.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 0b722b0e0604..fabe393607f8 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -1331,8 +1331,8 @@ static int sis_chip_create(struct snd_card *card, return 0; } -static int snd_sis7019_probe(struct pci_dev *pci, - const struct pci_device_id *pci_id) +static int __snd_sis7019_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) { struct snd_card *card; struct sis7019 *sis; @@ -1352,8 +1352,8 @@ static int snd_sis7019_probe(struct pci_dev *pci, if (!codecs) codecs = SIS_PRIMARY_CODEC_PRESENT; - rc = snd_card_new(&pci->dev, index, id, THIS_MODULE, - sizeof(*sis), &card); + rc = snd_devm_card_new(&pci->dev, index, id, THIS_MODULE, + sizeof(*sis), &card); if (rc < 0) return rc; @@ -1386,6 +1386,12 @@ static int snd_sis7019_probe(struct pci_dev *pci, return 0; } +static int snd_sis7019_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + return snd_card_free_on_error(&pci->dev, __snd_sis7019_probe(pci, pci_id)); +} + static struct pci_driver sis7019_driver = { .name = KBUILD_MODNAME, .id_table = snd_sis7019_ids, From patchwork Tue Apr 12 10:26:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560824 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CDC6C433F5 for ; Tue, 12 Apr 2022 10:37:08 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 59D6A1897; Tue, 12 Apr 2022 12:36:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 59D6A1897 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759826; bh=xCZ+4fZ8xZExf4Aql2gsVOm1fQI2QAHIrYECt3sC4iA=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uJlflI1RNidX4sX2GNytvUJSaAJJMql1dRmNfm3Yg58blQFg1AHI+eCxieoHpOqFX y4ei2klzf0tIO5naCWQPXevIWoqi/exbnx6yrII+nuzIwf0kARZ4oWfUcNtqULc/A9 l/QeApf2TwNPdWfhh8jxQq0erDESaz2Lv0V53G3g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D708BF80605; Tue, 12 Apr 2022 12:27:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1E6DCF805E3; Tue, 12 Apr 2022 12:27:40 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1451EF8053C for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1451EF8053C Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="r2TjCwNC"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="C5q7Y75F" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B88711FD11 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yTRz9w0+2BwzdW2kURkmLq+QBcI3dur4zsEOff0jXrY=; b=r2TjCwNChjXnI0eDzBgD7zIrGNrJNTLsm4NTBWz9FGD4LfcYpiOls2WEDGEgeI2dgk4MYs nPwPPyaELMY8c/Prc8kR7VIJ+DIa3VNMXzk4aK7lvSpcVKY0dcgbDY4tvplq7pcoBIzARN xeCDtpS9aYQNR074lBOOMqxys+wOkTU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yTRz9w0+2BwzdW2kURkmLq+QBcI3dur4zsEOff0jXrY=; b=C5q7Y75Fhg/DQy3toluuBrwniqIPrPm6RiVOC1IRk4EL5VdT8W4KOswQXhUeM7ItdoXpvo r3XOUVAYQmUqgpCQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id B3984A3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 28/39] ALSA: bt87x: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:25 +0200 Message-Id: <20220412102636.16000-29-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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[] = { From patchwork Tue Apr 12 10:26:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BABF6C433F5 for ; Tue, 12 Apr 2022 10:38:24 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 068CD1A7E; Tue, 12 Apr 2022 12:37:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 068CD1A7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759903; bh=ImkGrqioPwSEWOdEkPMxFXmNsfgaXQIJwncREgf/Bls=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gJ3fIzBC/CVCL5baUcg2BZIXXacVI7oqoxvfI58YkWBGcemzzOARzH5cxyWH2dO3X nx2iWKeHfIBdvMuCCSkVN1ihgGZbAJpGkzOzjOVaraYMpUf/x7qOmPPWyMfgi3C1q8 i3IbSwa/dZC/DNyLbOPF4eq0jp+4vYgCTOBUt5b0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8E170F8061C; Tue, 12 Apr 2022 12:27:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2C6F5F805F9; Tue, 12 Apr 2022 12:27:45 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DA1C8F80543 for ; Tue, 12 Apr 2022 12:26:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DA1C8F80543 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="foXIayOm"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="eV7QH4DM" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id BAF1B1FD12 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xiXeiCdRYMWCZdwLpZtcxju1lZt5yXk7EN3oMD1p5pc=; b=foXIayOmMVOx2sGb9JJN6YyX/bdOF2qrSpklFs4fRAk2769oTAsX5EOR6gfP8lHPKSa4wJ 0ggwxJqxad+nXvZiLQwtkyHyMKPB+/JprrEoWBu1E6Hxcb5zrG5QGGrMQnSRh8EToYPEFT K7OepJE2y0JyjG1/eKPeVo1zF48OUMk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xiXeiCdRYMWCZdwLpZtcxju1lZt5yXk7EN3oMD1p5pc=; b=eV7QH4DMcJX2YXDx93eQ9ZjX4rwYS194JEi3piujP6v5emsuTwZw/QrVR6jTQd19N17g6K ZIsTiZFVvym9X1DQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id B6782A3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 29/39] ALSA: lola: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:26 +0200 Message-Id: <20220412102636.16000-30-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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) }, From patchwork Tue Apr 12 10:26:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FE4DC433F5 for ; Tue, 12 Apr 2022 10:31:31 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8311918D3; Tue, 12 Apr 2022 12:30:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8311918D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759489; bh=wt5i+6ngVKDf1/j4vI4hwO2ClBULbczvYOduUjX+uDs=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QSx/V3zPr1YLNQRnFbmSh9NKcIkT30i9fJb6IjuoiLVIAaBCnTv6a076+Tpe6gRpn B6jYOEH+TrwBeVk5r0yL1SmYhXGYfA6cZqpliYQvw7Q1kWBewa2t/lX2rQIWWV9s2V WI4w9Sk1uEkeWkU+fQSaACTdduBl7WR8xcwUehzk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 48016F80528; Tue, 12 Apr 2022 12:27:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 633FEF804FC; Tue, 12 Apr 2022 12:27:10 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7EFC3F80511 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7EFC3F80511 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DRpOAF16"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="8QzbT7hU" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CA9452160D for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ocpSU+8MDLeDPndsCcDNujpYgL7ApkdjISDUQpECLRA=; b=DRpOAF16HgrJTUBG2jPUX2H5ao/88SmelPFkPvsMyoaN5e70fzhnUIWCMcyxUzDew1Yt9x a8lRV/T3F7oZdTsLUz14ZaygvFBViyRqCYTw3iKFClDI4Vf98mEyLnbPlmB8mbT7kisuHc zfVTEFiShUTNqGxlriiLs4esDm/09EA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ocpSU+8MDLeDPndsCcDNujpYgL7ApkdjISDUQpECLRA=; b=8QzbT7hUpTHzIb5wG88RT2PPvgVjd3ebV1KDdbaVrIZ8+88I0nPuA07tYG0xNea1suT3g5 WdrjrlqK/ix+yDCA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id B98BFA3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 30/39] ALSA: als300: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:27 +0200 Message-Id: <20220412102636.16000-31-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 = { From patchwork Tue Apr 12 10:26:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 559997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31A73C433EF for ; Tue, 12 Apr 2022 10:38:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6C5A418A6; Tue, 12 Apr 2022 12:37:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6C5A418A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759885; bh=8jYI0Gkx1Yn1CXTFDdfwh0QVY/c8OF5rp1hDk4UTAfg=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QT/0d61QreFsvjmzJSi+y1yJLGE4l7Ch5VurEytB40fzTJizvXP43V5xVg5itQiBx 9R7vWS28wdpDu0d0Yv57ROaShFRN/run9tKEGMm3O/bgZPX90CCStUf8/+tJHnqoaG 0qUcu3uXCkBBCCgBqM9mOfUVhwtwKmv1PPr0yYiQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C89ECF8061A; Tue, 12 Apr 2022 12:27:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3C833F8053B; Tue, 12 Apr 2022 12:27:45 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1B3B5F8053B for ; Tue, 12 Apr 2022 12:26:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1B3B5F8053B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="mD5VYwoF"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="SgyDoGHr" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id CE8BE1FD13 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UNCIGc1sJeHlIJHS+R/Ew+Y+LPENgWBoxqnO2oUY00E=; b=mD5VYwoFsugmMhNKGN6qaIgMYBjMUTYFZLSJ4jT0P+xtsxr1CWy4U552OW70BS8fg03fHl mYhvfYX7LJdSyYF3hB7sA9fKAlWxy6rcMJRwm/KTAvEVQClFhBYz9IzJtIPKKbCYW66Lu+ qEybnjbn+eg+EEOuUdHmymMtM9JnQno= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UNCIGc1sJeHlIJHS+R/Ew+Y+LPENgWBoxqnO2oUY00E=; b=SgyDoGHr9bOm9reS8OJZ3AK1/0pR8rRaFkH4zW1CZgHOkL3WnMRVqJS2oYxT2PaO5BBRPO WuPWLdJrRt7OMfBg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id C8745A3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 31/39] ALSA: aw2: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:28 +0200 Message-Id: <20220412102636.16000-32-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 */ From patchwork Tue Apr 12 10:26:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B2FCC433EF for ; Tue, 12 Apr 2022 10:33:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DA3631922; Tue, 12 Apr 2022 12:33:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DA3631922 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759636; bh=Qa/stgT6Rvqzn/qLGGOJQloHlOSYARVkd3WdYsdlREM=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UE5XnmHlLhJOY54WGjpkGq3UEYVQMUx7HvPeJan71z4Oecz6WnExuFyZhVXJbVzu8 WKbwtjCLReq8ijlpzcyoXZx/ZEvOPK86+jN55FO8FaMl/w1WmppypQMXIQQxG4xTGl hD5Du1j+W2QbrnU731xar2qkS8fnqqe8Oid8Lwz0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4962EF805DA; Tue, 12 Apr 2022 12:27:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9598F805C0; Tue, 12 Apr 2022 12:27:26 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 035A0F8052F for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 035A0F8052F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="hgYYT0rz"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="JJEXpc0C" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id DC8912160E for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4eMCnfUdgueNSa57I2JE7RHOdfmQkgMpe7AWbASFrbA=; b=hgYYT0rzUjWCvh9bG6IKkZwf24SL2XUwOSoaYTrGLWJx7rlB7Hup2U0U18kIiCOy855X8A 9kZRJxLC4XY7W3nf7AbbkKLb15XWvNdyH4QOEMD2b0ZPkhIp1pxaQFk8acmxEWykq5lXNP EibV9ZyeuvA4RZI8eRTMA/BzwqdhIFQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4eMCnfUdgueNSa57I2JE7RHOdfmQkgMpe7AWbASFrbA=; b=JJEXpc0CTYS4doah+JN1jHhZoqKVebWTfnBV37T1LBIXrrkCk6q57+UavAv0XgR4vHkVIH S9/xGu3XTZF2YiCg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id CC3CCA3B83; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 32/39] ALSA: cmipci: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:29 +0200 Message-Id: <20220412102636.16000-33-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- sound/pci/cmipci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index dab801d9d3b4..727db6d43391 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3247,15 +3247,19 @@ static int snd_cmipci_probe(struct pci_dev *pci, 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 From patchwork Tue Apr 12 10:26:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04377C433EF for ; Tue, 12 Apr 2022 10:32:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 44A6218CD; Tue, 12 Apr 2022 12:31:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 44A6218CD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759536; bh=KuwxYzHWcbakpwmXGrqaIbNVKBPrvtU8dtfzxvsjGB4=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SmxU8aPIalzcD2bEnUSX47chcXUe2ZhSF3M9CIazMAQUmq+rTS/kLXFXMdySpBfM4 gM0UwLjMDSh3++GLVNw4Zt5gx0hFNfmvPOdGopemknODeCmqeL3BUbOJ2DApNhBU3j rGTSLD93wEaDa1wAvwNYvkIgtWMFzcKw4OZ2z39M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BE365F805C1; Tue, 12 Apr 2022 12:27:26 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7018AF8059F; Tue, 12 Apr 2022 12:27:16 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 99CCDF8051A for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 99CCDF8051A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="gX9gpDET"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="pS6oHn4E" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id DE40C2160F for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jinagbs8lKz/MfmPyWnCcXXygsKUUcaJEFIZns36hAQ=; b=gX9gpDETir/xDrMjMMLF4NliR21rwnf8qFXjRrulUgg6ZSfCwtqsw0gbWANireW6rMQty6 PmDntWYYO3CZPOQfzkO2xM0g1Tp3O0UL1P/EyBFfnf2bM/FlXRnCVLhTLjeo+fdlfblhfe EKML74zK4gWFuDZsBcpRMVNTtTOIYXI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jinagbs8lKz/MfmPyWnCcXXygsKUUcaJEFIZns36hAQ=; b=pS6oHn4EdDW6UuSSRn/X3OI9qsSoi4I1wHnoOZ2UN/mulZvU+nsp5HniMLmiA/qpTxSc9b 7cSQUyUb/iTtu6Cw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id D9BBDA3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 33/39] ALSA: lx6464es: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:30 +0200 Message-Id: <20220412102636.16000-34-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 = { From patchwork Tue Apr 12 10:26:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4701C433EF for ; Tue, 12 Apr 2022 10:37:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1D9BF1A2B; Tue, 12 Apr 2022 12:36:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1D9BF1A2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759868; bh=AEyH57MTvawtOAsuxfkiQnYX2LLzgkZJ+rZekPT2MEY=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dkAzfoo7MdCryHfpbhHnyqsYpKWl6h9H1TAlz3eI6PQmbZRW5/5YjaACk0KomrnJT YjEhOKXhAgVGdb+CN+kQbmLWAhR640t8UrfEGGkeb0HpnBpwxyyFTTQvLPrae+DX6T qsq/AYrmeCwExszfSviErSZp/dse7B0GHyew3qho= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 23C82F80617; Tue, 12 Apr 2022 12:27:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1D6ECF805FD; Tue, 12 Apr 2022 12:27:45 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DA1EEF80544 for ; Tue, 12 Apr 2022 12:26:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DA1EEF80544 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="BalL5WZU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2R7rtcF0" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id ED1981FD14 for ; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RY+tXWqTR+Y2vaa7wS1mAczc6CBJykwGe9+uumAbI7Q=; b=BalL5WZUz7kyXNdB0it+eEdJZfT6j8LJbk8dm4/EW3TE+4q7L4psfLbPKkuLCbdb1tB7LR YtrODhs8qbWsrB/XN7UXJMskNAHmDQxbq8SyZFMcBUeVHPpKmXUkCQB/K0sHz/YIjYHgul avCbJfk3uUPZdFjrpfw9OWxlj8aYUAU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RY+tXWqTR+Y2vaa7wS1mAczc6CBJykwGe9+uumAbI7Q=; b=2R7rtcF0Jt907YRNiVyOFU/vXXKeN0FsA0cg/lnY1OadkKV2bifbdL3SmhlygK1sv8+qRX YODR7uKbY5fYUvAQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id DCB9AA3B87; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 34/39] ALSA: oxygen: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:31 +0200 Message-Id: <20220412102636.16000-35-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 From patchwork Tue Apr 12 10:26:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 559998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BAFE2C433F5 for ; Tue, 12 Apr 2022 10:37:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 179891A16; Tue, 12 Apr 2022 12:36:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 179891A16 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759857; bh=j2v8F0SfN/wZ0CO8fZNzJt7yVqMP4UlNtfzaamOO7no=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YnZHYC2MBDsEcxX2VgVn+u3wYjQcfFsqCsYFhwSWeQKKJ1Ru0ZP15VI5VSoaoBoXo lyOW6zJD4uFE5FFEudPpdN3Z8pBDq4SJjrfDfbaosbawzmyAgNj/rtIf89jwOJna7f 7HGKQXgW0gvnmtflhmZtTt5zudxZrAiPu+wxXGGs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AB1F2F80610; Tue, 12 Apr 2022 12:27:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E67C6F805F8; Tue, 12 Apr 2022 12:27:44 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 343CBF8053D for ; Tue, 12 Apr 2022 12:26:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 343CBF8053D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Q60ORTkY"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="T+uaEgr+" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 06D401FD15 for ; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SdSI5JhtHeo8YU8jGIafeQwmfoYHnxwsVXLg5Zr3uBM=; b=Q60ORTkYZ7xeb6yikcNgZ07Jp+4YmfwF77wzHkTdPKVV/E4xExOe+AYVIYHsOMNcGf2AaT f76jpla2ErkmaT96FnanhTU99xf5UUnP4ajUwT/+RQh0Tl4W1eBkpUgbAlAyOb9cm3X07k 0y402u53ZUQEahCBeIeEZH9a6Lqk86Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SdSI5JhtHeo8YU8jGIafeQwmfoYHnxwsVXLg5Zr3uBM=; b=T+uaEgr+/GDXOb1oXj2CW0oIUa8RmrXDZPjq4iNJBSzKvXR/hVXpmF9hvlOID8J2zB+q0v zMQITbU2oN+FYnDA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id EB178A3B82; Tue, 12 Apr 2022 10:26:44 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 35/39] ALSA: hdsp: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:32 +0200 Message-Id: <20220412102636.16000-36-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 = { From patchwork Tue Apr 12 10:26:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F216C433F5 for ; Tue, 12 Apr 2022 10:32:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 926FB18D7; Tue, 12 Apr 2022 12:31:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 926FB18D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759550; bh=w0g2qt4uf2X/1IQoImseasmKB7CJUoGApm2rCFKo8yg=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BLHbzhGGpDb2XgCDBZjjqnjGPMU7CHYGFD9xqRYUSKgWaWc4wO9enDiUOIZx9DhCx VzP/XJYDkKjj7iQ0Rh/VWQMgT0zcVS0NQtkJhjiy2STuDdXb/ep8BUT8tBQ2eGQCs8 Yj8O1ZMSmGiwBt4bcw0u/hP1Vd2hdTlL+zkIQ1ts= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 50F4FF805BD; Tue, 12 Apr 2022 12:27:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 553E6F805AB; Tue, 12 Apr 2022 12:27:18 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 98A11F80516 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 98A11F80516 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="JplaLmM1"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="X9HSMsvW" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0986B21610 for ; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZO/CJ6MDQkS8twgYIIHmlq9Se0NfnNgLoCTgRLKETg=; b=JplaLmM1eAgXmTBuewwUyaHFrIAxst3GFsfrDMK7e/hKZAquleVCXfbW3X4tUzCuiwwvP6 1C5JJdGQhwHhu15n50ODDgQEkCP3hcCfNUFenEB1oSlyiCIRAGqOhznDKMpzGROF4mhbPR oO7uE3FLlTvDzc6+sy6NTNzpof7PT44= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZO/CJ6MDQkS8twgYIIHmlq9Se0NfnNgLoCTgRLKETg=; b=X9HSMsvWkW/+s1kKgh0Grpbum7/e3uJ61lJMg2hddRTrekzRlJQf2Rs4ixepW3F4UX5zcl kd12S4FTcVJy/IDQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 045B5A3B83; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 36/39] ALSA: hdspm: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:33 +0200 Message-Id: <20220412102636.16000-37-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 = { From patchwork Tue Apr 12 10:26:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE5B2C433F5 for ; Tue, 12 Apr 2022 10:33:47 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 17DD0191E; Tue, 12 Apr 2022 12:32:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 17DD0191E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759626; bh=MwyBHd5ko2CVUfdBZdKImVThC22dzsyuB2f7HuTZFeU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LOQeJ4YkkJmUHTMPu16iXJTfW7ftobv9LJglSRyyxpjdme0T4IJ7ojTFvfsWfshw7 M2clw+d2BF09wGMfpDOWi7UiVnz8cuffmZEtzhsgpPFYE3ygK26DE4AFlesBquMMeF LGBaQxsaz7r5Ci/wUkygPBsNQIziSTGcHHl4jmQQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5BC43F805D8; Tue, 12 Apr 2022 12:27:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 69EF4F805B2; Tue, 12 Apr 2022 12:27:25 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ABC9DF80526 for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ABC9DF80526 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="QrfAFAAA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="jBwT05GV" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0C58121611 for ; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5LzHnZb/RPia00zKlb5KDq/JXdna9EYMtLb6ycagHow=; b=QrfAFAAA1vffYwTJCWopRjsXy6I1p9q58s5YPwBytg6Bm5ky5CV3/P8UJ9ScgTkVGiuL8J Ngti1yRwYIq6hwFCVSltmCHLJ7KoiA9/F+hw+3JXdbHVfcLJmb8Ij55rXioRL2blRlXxim ojgV4MwmfZdN1Ht79MRbeSPbZQV4bQs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5LzHnZb/RPia00zKlb5KDq/JXdna9EYMtLb6ycagHow=; b=jBwT05GVrd8UuI+whEP2hjjuV/uuRuryc5ERxX4UtGcHFtZ6MWYYfaDxF2tj6HX+bGq2uL qyllSNGmO1xi5zDA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 07600A3B87; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 37/39] ALSA: rme9652: Fix the missing snd_card_free() call at probe error Date: Tue, 12 Apr 2022 12:26:34 +0200 Message-Id: <20220412102636.16000-38-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Signed-off-by: Takashi Iwai --- 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 = { From patchwork Tue Apr 12 10:26:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 560829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1C1BC433F5 for ; Tue, 12 Apr 2022 10:34:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 139A31911; Tue, 12 Apr 2022 12:33:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 139A31911 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759673; bh=jnMaWXJW6GjMVOtPTxKVOdPoFp07E4LTnv0z/U7S7Wc=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gB4CjF8gENkAI5XwnPv+pHq5GQH0kEUQw3xkdFZHb2mJClT+wjiUspfXIYFyMOOk0 t9q+epyHrYaSik/8wwhqmYC/cQwyQIRnTfOAjgdl85wqx79ODaT1N+TTaZhIbsB6td +4zxSFsHkmpN3Enh/mxuQsBjKXKB91DMdm5nCxYc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8C9E4F805E6; Tue, 12 Apr 2022 12:27:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 01579F8052D; Tue, 12 Apr 2022 12:27:26 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D9C08F8052D for ; Tue, 12 Apr 2022 12:26:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D9C08F8052D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="UvciaLTz"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="OWMp8Dfl" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1A0E621612 for ; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ehylo5yqaXEf1g+aGbs/DleWSZeD8RPbeK8d2F2T+v8=; b=UvciaLTzvIHd8tOU9K0xQTsAe0NzS8zxp9sCrzXbH/xK7sryHAbeiPZIL5i6kkQNIH3yo2 PVnLYmKc8u2eiVE6o27N/cu446zXe5GEJOgoPbgunjU/T8z61P04FYxtWSNrAQvkkZ7+2d SMiFrKoxWxtcGfw5xNULi4JikNMZwfs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ehylo5yqaXEf1g+aGbs/DleWSZeD8RPbeK8d2F2T+v8=; b=OWMp8DflqEh1rSpUaqyyRtrs+KoA6W/BtBT1Xr9Egk4U8b1L+OtzAcDxBiy43BXkSDzdr6 8fj+mG1p4GN/KMAA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 0A830A3B88; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 38/39] ALSA: mtpav: Don't call card private_free at probe error path Date: Tue, 12 Apr 2022 12:26:35 +0200 Message-Id: <20220412102636.16000-39-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The card destructor of nm256 driver does merely stopping the running timer, and it's superfluous for the probe error handling. Moreover, calling this via the previous devres change would lead to another problem due to the reverse call order. This patch moves the setup of the private_free callback after the card registration, so that it can be used only after fully set up. Fixes: aa92050f10f0 ("ALSA: mtpav: Allocate resources with device-managed APIs") Signed-off-by: Takashi Iwai --- sound/drivers/mtpav.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 11235baaf6fa..f212f233ea61 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -693,8 +693,6 @@ static int snd_mtpav_probe(struct platform_device *dev) mtp_card->outmidihwport = 0xffffffff; timer_setup(&mtp_card->timer, snd_mtpav_output_timer, 0); - card->private_free = snd_mtpav_free; - err = snd_mtpav_get_RAWMIDI(mtp_card); if (err < 0) return err; @@ -716,6 +714,8 @@ static int snd_mtpav_probe(struct platform_device *dev) if (err < 0) return err; + card->private_free = snd_mtpav_free; + platform_set_drvdata(dev, card); printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port); return 0; From patchwork Tue Apr 12 10:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 559996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78787C433EF for ; Tue, 12 Apr 2022 10:38:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C72C81A96; Tue, 12 Apr 2022 12:37:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C72C81A96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649759916; bh=FbVJHItLsICAKfVRl+4pAOgtMEoggS7/eqn5Nud/CXU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iNYHEje4AYUw2q2xI1qePaOCKwne7avT1G6fyWAi2votoicbivgxGup+qrvnb7UY0 bpoy3laDEd2Poq7Z93vc8nRz9y3jzIK0iwb7pJrSLE35zwS6N09+WG6Bm1TfrUv3HL VdSqkA7rVYQyLWqrOw+LWw0AAoLCT7/ngXwOGjoc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1646FF80622; Tue, 12 Apr 2022 12:27:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 31A23F805F8; Tue, 12 Apr 2022 12:27:46 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3EACCF80542 for ; Tue, 12 Apr 2022 12:26:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3EACCF80542 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="d+l/CtWv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="tgwqiZVF" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 27BBD1FD16 for ; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03dgr07nhG4Rn1cIBF5pDGEidG7Jn4qc5FrK0AHa2ig=; b=d+l/CtWvVSN7dW7kC0kfMG8ZGCtl8ldy6N24KaFQ7IR4UhR14jaRt4nSz1eI7dFYBCsHGi 8i8DOGWx7sAgVWDgDtEVoNH+OmdY3MNGYf2QpCXAvcqoohxjJfNcluBWhB/K6Ov9ynhGpG tAijhrfCwGGzukp+91YuAY4o3ComSDY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649759205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03dgr07nhG4Rn1cIBF5pDGEidG7Jn4qc5FrK0AHa2ig=; b=tgwqiZVFGscLGSFCxZzIbMgzj3KFGJPKn7qnKQSzQR8L511E1WjQoCXjXo8RxMwMt8XKMO Q+070LUO7uhXu0Dg== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 17EC7A3B82; Tue, 12 Apr 2022 10:26:45 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 39/39] ALSA: nm256: Don't call card private_free at probe error path Date: Tue, 12 Apr 2022 12:26:36 +0200 Message-Id: <20220412102636.16000-40-tiwai@suse.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220412102636.16000-1-tiwai@suse.de> References: <20220412102636.16000-1-tiwai@suse.de> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The card destructor of nm256 driver does merely stopping the running streams, and it's superfluous for the probe error handling. Moreover, calling this via the previous devres change would lead to another problem due to the reverse call order. This patch moves the setup of the private_free callback after the card registration, so that it can be used only after fully set up. Fixes: c19935f04784 ("ALSA: nm256: Allocate resources with device-managed APIs") Cc: Signed-off-by: Takashi Iwai --- sound/pci/nm256/nm256.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index c9c178504959..f99a1e96e923 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -1573,7 +1573,6 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci) chip->coeffs_current = 0; snd_nm256_init_chip(chip); - card->private_free = snd_nm256_free; // pci_set_master(pci); /* needed? */ return 0; @@ -1680,6 +1679,7 @@ static int snd_nm256_probe(struct pci_dev *pci, err = snd_card_register(card); if (err < 0) return err; + card->private_free = snd_nm256_free; pci_set_drvdata(pci, card); return 0;