Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2857254pxb; Mon, 18 Apr 2022 09:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf8WbLw0qQ3gliJappTspNuoPWRkyO6HWVt5ogtxZq46sdpuzmtZ8XNcpXBQZmHLS7w44D X-Received: by 2002:a17:907:6d10:b0:6e8:8fbc:310c with SMTP id sa16-20020a1709076d1000b006e88fbc310cmr9537810ejc.530.1650300035221; Mon, 18 Apr 2022 09:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650300035; cv=none; d=google.com; s=arc-20160816; b=QK+sYfLiX2fbWdR5KKamx9EBGNp6I5gAHV83/G3IKPLNX+bl3Z62Dlwl/iez1xEbS/ 3NLhWCPDlKfl2iu+CKKdb873Lp5LaU8vo3YHtW/0huXCjCN6THTNdEwFjpWJOkJkpW7y jK7CdLCIAnPG7bQ+K2jWCSzN8RVYsbHeCI1CIpW0m2E0eK2O6i4f1ouiADoB/ywWjIv5 FHIQKTdaZeyU07UmbkHc+ZJZ8w+EBRho//2b+cGNdCOxuC/HTF6y/Um8lKfiBPe30vPR pXmXHJliGX4Pc7Ij929CvbTHO596aBfx+lZPXZBI/raRcZ5izeMXOCntF8B9xM7sDE3M 2NDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JopTIRYWeOQMewvL70JLOeag3dPGPO+uRUS8J9xmqvc=; b=RMV5tBOQAEzS0xkFjpLFusSYgbn4FaYvv20zAUYROVeZQe2DMG5L8Q5uBQLHBCTcW8 cXBk3I8+Z3SOwegSTuX1O3b0ge4bM1cbKgStftEzZSkX9UtqS8ONJjxIVU4CL92NWZaw h+Mtj22DWspl6ocFGUiBgfiatpvmmFaI9iY7rn++YJ/HubfjL90nHKSsbRPtf8tQ7d6d 0tWfj6vDHGun3jJOSl+VC7nJpAFZLfcsYB7K9J9a1dv8NVH8JYIWjSfanN+qtrTPeYHw 6L33wBuT+eC/DyESlmOnmHiiEbYSQ7AdV3Nqb+p5HNTQQA+E2n2eK88rsftKiaBEEHFe 4dRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V1J1s81f; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020aa7d654000000b00418c2b5bf72si6279124edr.596.2022.04.18.09.40.11; Mon, 18 Apr 2022 09:40:35 -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=@linuxfoundation.org header.s=korg header.b=V1J1s81f; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230515AbiDRMTz (ORCPT + 99 others); Mon, 18 Apr 2022 08:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238160AbiDRMTF (ORCPT ); Mon, 18 Apr 2022 08:19:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A83E11AF34; Mon, 18 Apr 2022 05:16:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3043A60F09; Mon, 18 Apr 2022 12:16:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21C07C385A1; Mon, 18 Apr 2022 12:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284174; bh=me2JiG04bt50ja4vIMnxGKL7aqCJOG/Y2pZhIZ4Ispw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1J1s81fb0DdKQWnR1OI0A/g108Tn9KOlCaPNOZwpgTojdPgVgNnwwGqn2Ic3GrjZ I3sdv5bOmbnKqZr8vYmc6s6tHMuMORxCFdnlQufiuo4mOn8pmAT4MdTECPjyr6lgto avcsT6POizmCeZn1N17Pf1w1+fPlcOdYXKUUthfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.17 028/219] ALSA: cmipci: Fix the missing snd_card_free() call at probe error Date: Mon, 18 Apr 2022 14:09:57 +0200 Message-Id: <20220418121204.948349226@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Takashi Iwai commit a59396b1c11823c69c31621198c04def17f3a869 upstream. The previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free(). This patch fixes it by calling snd_card_free() manually on the error from the probe callback. Fixes: 87e082ad84a7 ("ALSA: cmipci: Allocate resources with device-managed APIs") Cc: Link: https://lore.kernel.org/r/20220412102636.16000-33-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/cmipci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3247,15 +3247,19 @@ static int snd_cmipci_probe(struct pci_d err = snd_cmipci_create(card, pci, dev); if (err < 0) - return err; + goto error; err = snd_card_register(card); if (err < 0) - return err; + goto error; pci_set_drvdata(pci, card); dev++; return 0; + + error: + snd_card_free(card); + return err; } #ifdef CONFIG_PM_SLEEP