Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3161774pxb; Mon, 18 Apr 2022 17:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRKPdWsdgY4ANxanHeQP4CWa6W3imjCEsygBzxAUITPs/yzlEo7legr+QW3FjxYan7HINM X-Received: by 2002:a17:902:b698:b0:158:faee:442f with SMTP id c24-20020a170902b69800b00158faee442fmr7878641pls.75.1650328974347; Mon, 18 Apr 2022 17:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650328974; cv=none; d=google.com; s=arc-20160816; b=TtMU0J4sSayI9K4uCyL2qw+ycUUKkI63pOKzD+BiMQ3JISxsVKTfT7MaClPG6WoybC 4Q78c3Qek94grW5iy2kYTASB+9ofifSMNRk/xrIgDhV5GQ6j0DmSAt28wJXOLu64Ld5K tyS9fz/yiJkOvzEWEyngliSbhdk7wI/+DDkcuu5SDqdEDqD3hwxajofURBdVYH7/aoPD iwanSZ9ndOlAjBzGI69JvCgTxU0GfJIOCKc3vIfn8PMI35m6vLx6I4MiSEgJRcHnyGW5 SoKdA6XAg+3m5IqlLokAwVAX2p69NRPoq8Ugd+HMJ4NNtRXkjf7teiHNL3E0HdIOYQxS DAUQ== 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=ij6PsMWd64ALMaBj0Gij1Nk/9RWTVmewtP2cXAQ6miA=; b=XB25HYn1ETdUTFmPtQ+Qmb6gYQ/I40fnSyzu8lx4+XmF1QDBtCz19GcM6n3Ex+SiaM rBI/BEpTi63EtuS3eTku1CHIETj9CGzIu1rkJLE6MTxd3wB4SbhMgrpcdc/H/2f8wKNR OT9tv7jwsXcGlg8Pat5CrRlBFQUS3P8+kd3QiPgDpy7eg743NwIhR1jgsqaOAM3jcs/H tluqXWo5+tWGjqCfSP3Op9EVOsA7uMG3GzkQrLenYib1j4niZhRBFpsP5h9V9S1I6TDN 9cqcqeYqBiCHIS//BUvBCBjGm5jhqU5feM1SZe/5IzzbSBtVfqEf/5Q702rffZv8+Bew xmkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ne2I07mr; 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 z11-20020a63b90b000000b0038224514dd9si10558334pge.699.2022.04.18.17.42.38; Mon, 18 Apr 2022 17:42:54 -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=ne2I07mr; 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 S237553AbiDRMWM (ORCPT + 99 others); Mon, 18 Apr 2022 08:22:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238438AbiDRMVb (ORCPT ); Mon, 18 Apr 2022 08:21:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3CB51D0DA; Mon, 18 Apr 2022 05:17:32 -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 6ADC2B80EDB; Mon, 18 Apr 2022 12:17:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 969C9C385BA; Mon, 18 Apr 2022 12:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284250; bh=1GZdEwx0jW2sHnXThBh772tRCExCXNl/wQviBjG0fQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ne2I07mrGY5nbX7+ui43X+F44Lhe3keNxHLRrgWpLXGV9+l6vuupEnXzsl3gW0XNB QHsaCQkpRQx6UHwUc4bGWFioa7c+u502djqBDB9hF2R5QhL/Ij9He1Qm9JEmc4Jgvz pJmqqcNftJcaE7pHiVZTAUWf+SqbaFBpladh3V5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.17 053/219] ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error Date: Mon, 18 Apr 2022 14:10:22 +0200 Message-Id: <20220418121206.625061023@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 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(-) --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -1387,8 +1387,8 @@ static int snd_sonicvibes_midi(struct so 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_de 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,