Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2924857pxb; Mon, 18 Apr 2022 11:09:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2D/huEfBB793fiubIDroLfMXyFj9hBTjTIvGxaTrqYaYJ4Wz+YoVLjp3N+c9GCWYMN4lC X-Received: by 2002:a17:906:7316:b0:6d7:16be:b584 with SMTP id di22-20020a170906731600b006d716beb584mr10033407ejc.759.1650305347419; Mon, 18 Apr 2022 11:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650305347; cv=none; d=google.com; s=arc-20160816; b=0vWxWzIIk5o51IXf5PgR68FTGiLTU1A40XhMGxE2zakuZiha31agHK/xQj1va92SBx e+1AKnc09LuJxI3Ch6aoevexhDDgGime6ztQvUOo9A3UUx/bn4jHfH6mFL7IBHCSm5/x tlgTnm/r5WPDTLllTzniKcXuek/TbyH8/IzAS2eKRv2m93f0xqYJgSGs98sS5lOKLYmf Kz7K7t/Ud+GYLK6oIhE7ps8gEPFX1Q8xavsa7ZKH42+36TWkgdYCOMjOM/z8jIC+Z++q 0xnUYHeIldlAhiP4Twa5ujGFDuZbs+laWG8ETCjorzD1exPXZ23JF51b4p5iMuHylyKW ASvQ== 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=OK4m0AMEEyigtCugsf36JYdYpJvpqC8fx6bO6D25XPc=; b=CnhRQP0Uhhzn8G2TOY2tllUBYNmKX7EtZPyrH1i0sgsBoMY4GBmpO0SvYx0FgU9zKO 73tdO6l2s+1PSD/GbWrkpGInwwRTG5cMiQ6o2fdDmVVLftPMEuAMvTRbB6sAvPS0FMNq GvVqQ02LjwJCqZnELObEsHK9aN3qZFkNuOBbJ1g91E4oByBm7gqbaQjLmALqCHXIvENS PIi+o0biZnLG7ybA2biYdwtg7hDfadkIT5fsZDtxbgxTCfVmGRy1Qd57iU/yD/EAaUAM jJUpgNyfaKLLmTf6rBq/B42JwlgBlZcY+QS2T0/D7BqydXAbgO/v/k0hkey+B1k1rz6E BS2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2HDXnhyW; 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 s13-20020a170906354d00b006df76385eb8si6801424eja.856.2022.04.18.11.08.40; Mon, 18 Apr 2022 11:09:07 -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=2HDXnhyW; 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 S238710AbiDRM0E (ORCPT + 99 others); Mon, 18 Apr 2022 08:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238568AbiDRMYc (ORCPT ); Mon, 18 Apr 2022 08:24:32 -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 29F2D201A4; Mon, 18 Apr 2022 05:19:14 -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 C84E0B80EC1; Mon, 18 Apr 2022 12:19:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C130C385A7; Mon, 18 Apr 2022 12:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284351; bh=l5GEYdVvrpq7rDwXrThnXTWrkiC1z6bXt6boBcfW+9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2HDXnhyW09kZtfBYRuhL6uhVXUVFvK+IDe6RB6PTEQrk46CIJ4rU6izE0RMemsA4r XvipWPUV58AjFmqBmJsesciL29rlMm9XW5bFxYkySN/0SJZ/EDoiV3w/qpoAZFPDTb fpjPbiV9pCGhMfxq8HAeC94X8NbbU2FGEByi3fo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.17 045/219] ALSA: lx6464es: Fix the missing snd_card_free() call at probe error Date: Mon, 18 Apr 2022 14:10:14 +0200 Message-Id: <20220418121206.083885210@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 60797a21dd8360a99ba797f8ca587087c07bb54c 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: 6f16c19b115e ("ALSA: lx6464es: Allocate resources with device-managed APIs") Cc: Link: https://lore.kernel.org/r/20220412102636.16000-34-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/lx6464es/lx6464es.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -1019,7 +1019,7 @@ static int snd_lx6464es_probe(struct pci err = snd_lx6464es_create(card, pci); if (err < 0) { dev_err(card->dev, "error during snd_lx6464es_create\n"); - return err; + goto error; } strcpy(card->driver, "LX6464ES"); @@ -1036,12 +1036,16 @@ static int snd_lx6464es_probe(struct pci err = snd_card_register(card); if (err < 0) - return err; + goto error; dev_dbg(chip->card->dev, "initialization successful\n"); pci_set_drvdata(pci, card); dev++; return 0; + + error: + snd_card_free(card); + return err; } static struct pci_driver lx6464es_driver = {