From mboxrd@z Thu Jan 1 00:00:00 1970 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 8C46EC43334 for ; Tue, 5 Jul 2022 11:57: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 17CB616BC; Tue, 5 Jul 2022 13:56:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 17CB616BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657022260; bh=s2TRPnouG/R8YQugG5nOT0ZNmX1whp2QW+4rIXCYJu8=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iXWSO1zzbZJZL4lpqixii7ozAwTeSkjzjdvqV0p9b5eqszfgzzz/zFIq6vFUUJMfq Jfl1nCcv70yCh1AZSEQpVVsOfOf6gmsQ4b3dw6deoExCv091Bwfwdz9qjnmY8SKP9n jWDJYqi1adFenoZcfPCNU1hleuI4Wdqr8RFmL/Vg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9CCC4F80153; Tue, 5 Jul 2022 13:56:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D10A8F8015B; Tue, 5 Jul 2022 13:56:47 +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 D3F2EF80104 for ; Tue, 5 Jul 2022 13:56:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D3F2EF80104 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ue0BvSHj"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="TCo5RIKr" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CC73E21892; Tue, 5 Jul 2022 11:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657022200; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cLuoK5JGT2eXHO0cJ7kh2a9mXgAReW4i3StHieVHhGs=; b=ue0BvSHjzwoHqrvid+ks0qbJQmdvExbaHJqu5NM9N9h+P15qaX3l28bWldbc28EZe4WtPR clB1EwQWU6YWwgK/IDu9GECjuXpQaJGxQPjUncZWooS8iI4ziqaUwcFXe/tCLwyQQ0C0hJ FAJVshNCdcjHUi4JKF+KxZW1b43srLk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657022200; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cLuoK5JGT2eXHO0cJ7kh2a9mXgAReW4i3StHieVHhGs=; b=TCo5RIKr8fpRMBzdOB8xCQn+NPDIPX7KvJWKhSu+irwiBl0AlaWZg48a8oSY9WnDvBjpNq 5lfhiI678nFw6DCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ADEC51339A; Tue, 5 Jul 2022 11:56:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id vcmrKfgmxGKrOAAAMHmgww (envelope-from ); Tue, 05 Jul 2022 11:56:40 +0000 Date: Tue, 05 Jul 2022 13:56:40 +0200 Message-ID: <875ykbvklj.wl-tiwai@suse.de> From: Takashi Iwai To: Jan Engelhardt Subject: Re: snd_cs46xx regression, producing Oops In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" On Tue, 05 Jul 2022 12:56:14 +0200, Jan Engelhardt wrote: > > > Commit v5.14-rc1-39-g5bff69b3645d introduced a breakage into > snd_cs46xx. When loading the module, an Oops is thrown. The system > works fine afterwards, but the final reboot/poweroff message to ACPI > has no effect after such Oops occurred. (Blacklisting snd_cs46xx > works around the reboot problem.) > > bisected to: > commit 5bff69b3645db7b3018ecbc26218d8866aeaf214 > Author: Takashi Iwai > Date: Thu Jul 15 09:58:52 2021 +0200 > > ALSA: cs46xx: Allocate resources with device-managed APIs > > This patch converts the resource management in PCI cs46xx driver with > devres as a clean up. Each manual resource management is converted > with the corresponding devres helper, and the card object release is > managed now via card->private_free instead of a lowlevel snd_device. Could you try the patch below? thanks, Takashi -- 8< -- From: Takashi Iwai Subject: [PATCH] ALSA: cs46xx: Fix missing snd_card_free() call at probe error 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: 5bff69b3645d ("ALSA: cs46xx: Allocate resources with device-managed APIs") Cc: Reported-by: Jan Engelhardt Signed-off-by: Takashi Iwai --- sound/pci/cs46xx/cs46xx.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index bd60308769ff..8634004a606b 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c @@ -74,36 +74,36 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, err = snd_cs46xx_create(card, pci, external_amp[dev], thinkpad[dev]); if (err < 0) - return err; + goto error; card->private_data = chip; chip->accept_valid = mmap_valid[dev]; err = snd_cs46xx_pcm(chip, 0); if (err < 0) - return err; + goto error; #ifdef CONFIG_SND_CS46XX_NEW_DSP err = snd_cs46xx_pcm_rear(chip, 1); if (err < 0) - return err; + goto error; err = snd_cs46xx_pcm_iec958(chip, 2); if (err < 0) - return err; + goto error; #endif err = snd_cs46xx_mixer(chip, 2); if (err < 0) - return err; + goto error; #ifdef CONFIG_SND_CS46XX_NEW_DSP if (chip->nr_ac97_codecs ==2) { err = snd_cs46xx_pcm_center_lfe(chip, 3); if (err < 0) - return err; + goto error; } #endif err = snd_cs46xx_midi(chip, 0); if (err < 0) - return err; + goto error; err = snd_cs46xx_start_dsp(chip); if (err < 0) - return err; + goto error; snd_cs46xx_gameport(chip); @@ -117,11 +117,15 @@ static int snd_card_cs46xx_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 cs46xx_driver = { -- 2.35.3