Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6756705rwp; Tue, 18 Jul 2023 05:36:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlEypervmRvD1Ajnwy1FurnDj37rlTK+XaG3CU2WPQ4HVWtLQW4zZ7WMkMqXdafuvCaakUzj X-Received: by 2002:a05:6a00:21d2:b0:681:142f:e8e3 with SMTP id t18-20020a056a0021d200b00681142fe8e3mr19597767pfj.14.1689683777470; Tue, 18 Jul 2023 05:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689683777; cv=none; d=google.com; s=arc-20160816; b=MHWHMIedniHIfPwoIaapOmlG+X2kEMCoOsEGySIs1gfxko4kqZFuJPotE4g+5gXSql UxA0uwBQgzycDlB+JXGCxFU8SdFb2sNhTdWQm7ex37UnIoDT/0CFje8vGhxK5hsCwwwh XBUIhHTE4X9A0c8EIRjfQHysDqcrxdnuu3Wms9GVvWJTiH9/SFdG/UU5AuUIJynb2p9y WSGdGc9RQkmp17pb8PVRUOckQOfFKXmgvvG3Q+e5tfBQ1sJGUg6alglEQ8wkVwmTFKwf TwIwfyzo7aayf8PWlBlOrUGL5NhC3vd4RkG5obOLoX6AZAk/DmodTWR0O0VQov/bKfwi yQ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=4TdEhciiSwsv5vinAbnDrmrQzodZb9a+RU42WAAQt0M=; fh=1/NIQCDXuSTN/p5UTl8yTdoxUe2XNha5jbtKJN986X8=; b=Wm/5yUCDS9+DLQ0wufywvTR5MyStr9SMuGSKWoPa/9iwbkcQDYvI0yk8PVQIW1TCge HSvvhdgGD8uPB1heICKNaTwdBtzpiGod0bJTbxOCbaVPXSKKzTHQcFpcPU7pTsD13kiu eZb6e0gZBjnEGnBi/xNsgFGHLMbJ52X4DbL7Z2cm6B2a7DgELea4qktLumhO3ul8nFUE 2eY0SZxabZLV5+e5RTqE2yUsb0Y1TnYmEfQldDVboaDZv0nyMx25W+NrtLEaW2CUW1Vt ATG1GwTnCynDt4LAX7wESoM8iUNH/TTnTsWRzaG5HBS3Xin1mULQFg63EZSwxzjT53TR 4iCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=xynSjjn5; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a056a00218c00b006828af9aeb5si1510382pfi.352.2023.07.18.05.36.04; Tue, 18 Jul 2023 05:36:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=xynSjjn5; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232101AbjGRMRo (ORCPT + 99 others); Tue, 18 Jul 2023 08:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230440AbjGRMRm (ORCPT ); Tue, 18 Jul 2023 08:17:42 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54BBEE77 for ; Tue, 18 Jul 2023 05:17:37 -0700 (PDT) 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 1345221954; Tue, 18 Jul 2023 12:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689682656; 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=4TdEhciiSwsv5vinAbnDrmrQzodZb9a+RU42WAAQt0M=; b=xynSjjn5vO58svXXYtRPzXTmqfuY8J/pBE2ZwCwpX6QGrZsy64IEF81aYnFjt8ghkcL1I2 8nVyxCoz1z+tHbV4Tx/r2p4j1ZihUw244OmvgBT7HvA9Fdjy9GHF/dm76wrUedFQc0CvWA 6bdeul9ncCG8FKuQnj7GzkBMPot/VxU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689682656; 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=4TdEhciiSwsv5vinAbnDrmrQzodZb9a+RU42WAAQt0M=; b=6vItAQ41n5VLJt25wmWVdXqagnbDSsn7dzfymZpluHCe/p20Cnhrn/aFlX86UgESy2LzkJ ZDrcARvCW4EKOlAQ== 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 B7127134B0; Tue, 18 Jul 2023 12:17:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FhivK9+CtmTnQAAAMHmgww (envelope-from ); Tue, 18 Jul 2023 12:17:35 +0000 Date: Tue, 18 Jul 2023 14:17:35 +0200 Message-ID: <877cqxo1ls.wl-tiwai@suse.de> From: Takashi Iwai To: Maarten Lankhorst Cc: alsa-devel@alsa-project.org, sound-open-firmware@alsa-project.org, linux-kernel@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Daniel Baluta Subject: Re: [v2 PATCH 1/2] ALSA: hda/intel: Fix error handling in azx_probe() In-Reply-To: <2a727311-46d8-e999-1461-2ed2f1b704e0@linux.intel.com> References: <20230718084522.116952-1-maarten.lankhorst@linux.intel.com> <20230718084522.116952-6-maarten.lankhorst@linux.intel.com> <87h6q1o82l.wl-tiwai@suse.de> <2a727311-46d8-e999-1461-2ed2f1b704e0@linux.intel.com> 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Jul 2023 13:57:33 +0200, Maarten Lankhorst wrote: > > > Make sure azx is freed after azx_create() succeeded and an error was > encountered. > > Signed-off-by: Maarten Lankhorst > --- > sound/pci/hda/hda_intel.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index 5af1138e745bc..196ca76ac43ad 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -2150,7 +2150,7 @@ static int azx_probe(struct pci_dev *pci, > err = register_vga_switcheroo(chip); > if (err < 0) { > dev_err(card->dev, "Error registering vga_switcheroo client\n"); > - goto out_free; > + goto out_azx_free; > } > > if (check_hdmi_disabled(pci)) { > @@ -2169,7 +2169,7 @@ static int azx_probe(struct pci_dev *pci, > &pci->dev, GFP_KERNEL, card, > azx_firmware_cb); > if (err < 0) > - goto out_free; > + goto out_azx_free; > schedule_probe = false; /* continued in azx_firmware_cb() */ > } > #endif /* CONFIG_SND_HDA_PATCH_LOADER */ > @@ -2187,6 +2187,9 @@ static int azx_probe(struct pci_dev *pci, > complete_all(&hda->probe_wait); > return 0; > > +out_azx_free: > + azx_free(chip); This is superfluous. Once when azx_create() succeeds, azx_free() is called from snd_card_free(). That is... > + pci_set_drvdata(pci, NULL); ... only this call was missing. And this can be put under out_free label, as this is safe to call at any exit path. So, it'll be a oneliner patch. thanks, Takashi > out_free: > snd_card_free(card); > return err; > -- > 2.39.2 >