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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7D68EB64DC for ; Tue, 18 Jul 2023 12:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232143AbjGRMRp (ORCPT ); Tue, 18 Jul 2023 08:17:45 -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 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 >