Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3963810pxb; Tue, 19 Apr 2022 13:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlRZ5i5rGZtbXBpoP5uOd7WbU9MfylNsuCy/RWPakwBfdzzMuzONN1NpK3dUTB5ZwdisPg X-Received: by 2002:a17:90a:8581:b0:1b2:7541:af6c with SMTP id m1-20020a17090a858100b001b27541af6cmr471706pjn.48.1650400869342; Tue, 19 Apr 2022 13:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650400869; cv=none; d=google.com; s=arc-20160816; b=gWGq0jhLxpyFXN8Ek6FTLG95lUQScYzQPPiNb7g2uxWN3fZBM/yt72w4RiLL8heInb X9i0p/kShJVsYo3UwVw6gk83PgUUHz9JN9/KJ1KFePVD/ojNCNqtppmifHhi6I+vM07j Fu+vYOOgFceGlyzkWOCCVmBLrNQyZrokk7kalOWmiAfLqLZ1gI0C13Z++0rNaWgTfBZK wouWEmJtxVwF/yJaUtXnrzIXAc42WbIS2nEpE1sb4TU0lUdI5VnxFON5RZtx5jBpg388 tHiEP++Xkd0wYA5xn9EvYe3jjOvT8t86l86rJN4z9FAc3RdEd4FyDL9Y8TzMSLXxaefi xWcA== 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=ETh5jeyQOtoC0Vas232NCvoJoSof1LdpeiIR771lIM4=; b=wD2MOSPY7bvyWdFp+2WdUE4A8DBJYiQMgf1koLHqh1MR1THybVYKmX/OgE8eI16Mhq VoAwnzBSZyISozYVQsFVQHqv2WD2AW7QU8hWiiFxdMvBIAVVYELGFt1vAsQPNiPcRwuU crBO8pDSRYhdceLM25ngjTf4zO/3sW4rCXF55QylobA4NijTdjWcZ+8mrCOAZ+eB3HWj oxSAzjGzLvvlJPwhs/5QRRBVUYb/4S9wVIucTdLF7ABzTUU8B+s2hkbZfUDrlLCCameM xZu+UO1PvTjyChBsP8R+k8qZgKVpnW2W4kfGglqp1Ld/f/NZICWe9WDifQjM4Q16qKp/ tABQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LstOI/JX"; 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 j5-20020a170903024500b00158d4c799a2si288757plh.181.2022.04.19.13.40.53; Tue, 19 Apr 2022 13:41:09 -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="LstOI/JX"; 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 S239995AbiDRMyB (ORCPT + 99 others); Mon, 18 Apr 2022 08:54:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240477AbiDRMjQ (ORCPT ); Mon, 18 Apr 2022 08:39:16 -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 4C95A286FD; Mon, 18 Apr 2022 05:29:44 -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 9EFE86112C; Mon, 18 Apr 2022 12:29:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1C96C385A7; Mon, 18 Apr 2022 12:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284983; bh=kw+P+Q2um2sfgDyO73eLtQasUJ3xATpBMsqOEloUQsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LstOI/JXU51y7Nfoz6dEqjR3oO+OayU3WmyP6mY04jT66CAOxObExmQD2SljPH8dX g5AD4O34niya2G/3YofgtDMgQsZUws9dPubmpUxMvKQ503jBWCBWRaAT00xGQAnQSI HVfJ3ddZa11xa3l16M8EBfoL5FX4cjOnNw9SwJsg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.15 052/189] ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error Date: Mon, 18 Apr 2022 14:11:12 +0200 Message-Id: <20220418121201.989013889@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121200.312988959@linuxfoundation.org> References: <20220418121200.312988959@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 b087a381d7386ec95803222d0d9b1ac499550713 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() on the error from the probe callback using a new helper function. Fixes: 2ca6cbde6ad7 ("ALSA: sonicvibes: Allocate resources with device-managed APIs") Cc: Link: https://lore.kernel.org/r/20220412102636.16000-25-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- 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, -- 2.35.2