Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2810391pxb; Mon, 18 Apr 2022 08:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvmo9JEYonR39hhnK1H0wlkeEh3Tt/1C4Qx32s3ZZvTJSfdWGXLj82WbmsoOFzM3IRrgNT X-Received: by 2002:a63:60b:0:b0:39d:9bb5:7fba with SMTP id 11-20020a63060b000000b0039d9bb57fbamr10476145pgg.181.1650296532945; Mon, 18 Apr 2022 08:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650296532; cv=none; d=google.com; s=arc-20160816; b=HW9O3w18SSWzYqr1ZFYGaMFueIWUJfIr2NnOy3kxqSiNBzgW4LcQRjkUkJQdgEE//d PfuucTULS1XJvRUrBcS3ELKaMYTE5eW8FNKwdYWk7+iA2lxtR/+MSzJuQHuPnuH+2UFY az+rV3fAaAtHa6zm0PPLiYpiD3RbKeM/teuoUJZxg9z3tcwrfCjlp3JXnbFxvVH5K4By WltQtYlGBbRqST32wvxxb60U0tWcFLmWxwmFB138RrBgi6fBjSqGfC9g3cI/9H+HJreX a0swWGYX27oGAfs2PbBVG4BjF8jFJFBpGVOAk0c2mEjpoycT3A6Eq93MxkMuQIlQvASz X8ww== 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=tqAqednu54c5I6Vjjxx0zcDf2bKVv1wl2jomNjEaIxY=; b=ks+w+5yT1/BBmU25acDCc5YXTaRkMg7sVznByjpl9ZTSdoEAmH9yHxG8OlcF+tDbsW rKiKfu8/e6r+nY3BvnTkPfjBEXFpH1NfEKhIaD+EPIQjoT//TZWfpK+K0eLppx0InArD WlnyrJaiBhFc9P9a17yzln/cE4pPuCD6uBA2f+R78FbKmlMIGiXc35cyqVFxjKR+Vg43 CtsyBR5MI17iBMWS98ldD1bChhktq9k1JpFn4o07aknhUWzo0/UrlPUxXpzqWjRpeF/l QwKdyWxOM96TfpcDuy1on9zw2FY5qNcjz9+KyrHykkkAB8JC8W0wFXZ+hMQ5Azj3Vo2G ZNGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OAwjWYIX; 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 s14-20020a63924e000000b00398df5b29a7si8898319pgn.878.2022.04.18.08.41.57; Mon, 18 Apr 2022 08:42:12 -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=OAwjWYIX; 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 S238277AbiDRMTa (ORCPT + 99 others); Mon, 18 Apr 2022 08:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238142AbiDRMSn (ORCPT ); Mon, 18 Apr 2022 08:18:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5271ADA1; Mon, 18 Apr 2022 05:16:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3D7E0B80ED6; Mon, 18 Apr 2022 12:16:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 870B3C385A7; Mon, 18 Apr 2022 12:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284161; bh=LUJ0kdq4mD4lTynwRVHbn/7vOyhocmAmauLePmXEP50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAwjWYIX6JiyCMl6Zisjf74eKDsYJ+QUH/UpmkLd3QLMOxruNGbHrT2ZFkNDV2n10 cRpL4ZmFl9OXwkqdHpmTlfGUl5C5ht74kWAcNCkrVm/eKNhkdfrQ3t21H2C1an1bu6 UqH2WqmevDeRqBuXSHx5w8+CldyuT6KjByBkSh5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.17 025/219] ALSA: azt3328: Fix the missing snd_card_free() call at probe error Date: Mon, 18 Apr 2022 14:09:54 +0200 Message-Id: <20220418121204.761761563@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 49fe36e1c02cb06f66689c888e4e767c31cd259d 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: 8c5823ef31e1 ("ALSA: azt3328: Allocate resources with device-managed APIs") Cc: Link: https://lore.kernel.org/r/20220412102636.16000-9-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/azt3328.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -2427,7 +2427,7 @@ snd_azf3328_create(struct snd_card *card } static int -snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) +__snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; struct snd_card *card; @@ -2520,6 +2520,12 @@ snd_azf3328_probe(struct pci_dev *pci, c return 0; } +static int +snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) +{ + return snd_card_free_on_error(&pci->dev, __snd_azf3328_probe(pci, pci_id)); +} + #ifdef CONFIG_PM_SLEEP static inline void snd_azf3328_suspend_regs(const struct snd_azf3328 *chip,