Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2185809iof; Tue, 7 Jun 2022 22:32:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyArNTa3YG1xCL8v+6d2MZEOXslk2Hs01A5UniDOabH8Hi5jKqQkep9v5OfVi9KAX9q5hT X-Received: by 2002:aa7:9728:0:b0:51b:e78e:b333 with SMTP id k8-20020aa79728000000b0051be78eb333mr21422193pfg.36.1654666345459; Tue, 07 Jun 2022 22:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666345; cv=none; d=google.com; s=arc-20160816; b=l8yt5Ej7fU7mUXH2I8vOhhYHPIbQycSqiDDcafu+aYfI7ALYYuffKa78lztTYK7uXs 0Lu5XOSAUyHK/qmdHReM1mi2rRHEm42wCveDbTfP7Thskinb7Gf8/X7rkESSGMQzQ1jP sVFNAlALKA9K7BXH5icGapkiAIhB+Fz631fli+SChkRv/wmlm80kgr2ghQsYvh9tVnZz wvmgEzIED74FgKe62tgmVQhYY2N2hq3irxkoqpBaxQU5QfiwCUy19ZWWn0oYJowVbHuW yWABHJC0rcCraV6P9mLGh1f0j2hhoR1vgkZV6g6qdFy9xWKyRxELUoHC0DBIH2QjE5eJ MbRw== 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=NdpRf1yC1JFQxOccamZrEZcJZJnweAoWTUjQLQ98lAU=; b=fom9O0aaADk5nUgmdQYq05XRaBmUtQJHAVIxi1CQG4a4kTKD82Ie1X9ISLGKvDh3Th WS1cjMfVC89DdEoSBy0nnykwVjSVnk1opQaoV0G2P9dz1v/0chFkMvGI7G9vE5iD76Tz HH2tW5RUq8tjM2JwuJP8+/t3plzFwwVc/Pem27Qff26WcZqVTkIYDMHzem7CND1M5Az2 I+p2qBfVf1LCTj3KIuXE7lg9pEHSdz5bHtqjyyQEcWHmFLBH1Rwy7Z581mihUxFiNWGp 5CaQhvBPGzZA47p0PEsDeAI/THWaksffXHJkqtcpbuwepKWkpkYTBLhkBu0uRrc6gOjo 0HUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PeLgcj2u; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lb11-20020a17090b4a4b00b001e303b38826si30828947pjb.134.2022.06.07.22.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:32:25 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PeLgcj2u; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0B2354928C5; Tue, 7 Jun 2022 22:00:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385917AbiFGWrU (ORCPT + 99 others); Tue, 7 Jun 2022 18:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380683AbiFGViQ (ORCPT ); Tue, 7 Jun 2022 17:38:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13EDB17FC0E; Tue, 7 Jun 2022 12:05:25 -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 7D5B6B823AF; Tue, 7 Jun 2022 19:05:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE920C385A2; Tue, 7 Jun 2022 19:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628723; bh=S3TbxDKomXjqsFipStdTUFmVt6naxHpuRLRutjjre40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PeLgcj2uYENw4sH9cJ2l8EapWR9igAQqjgxLkBXALWRbmAtEwfAo9/xFw6y/B6Tfm S7116BVb3bRFxnyb15RoDGX7oh0FJZJQNTdYBVKCqyqdycwGZiAPl1Z1k3eh1zjNDr /9W1w0KYqtOWp36rSjdGkIsjMdqm7r1VTozhy6mc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 432/879] mt76: mt7921: Fix the error handling path of mt7921_pci_probe() Date: Tue, 7 Jun 2022 18:59:10 +0200 Message-Id: <20220607165015.410054029@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Christophe JAILLET [ Upstream commit 4e90db5e21eb3bb272fe47386dc3506755e209e9 ] In case of error, some resources must be freed, as already done above and below the devm_kmemdup() and __mt7921e_mcu_drv_pmctrl() calls added in the commit in Fixes:. Fixes: 602cc0c9618a ("mt76: mt7921e: fix possible probe failure after reboot") Signed-off-by: Christophe JAILLET Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index 1a01d025bbe5..062e2b422478 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -302,8 +302,10 @@ static int mt7921_pci_probe(struct pci_dev *pdev, dev->bus_ops = dev->mt76.bus; bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops), GFP_KERNEL); - if (!bus_ops) - return -ENOMEM; + if (!bus_ops) { + ret = -ENOMEM; + goto err_free_dev; + } bus_ops->rr = mt7921_rr; bus_ops->wr = mt7921_wr; @@ -312,7 +314,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, ret = __mt7921e_mcu_drv_pmctrl(dev); if (ret) - return ret; + goto err_free_dev; mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) | (mt7921_l1_rr(dev, MT_HW_REV) & 0xff); -- 2.35.1