Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4445490imw; Tue, 19 Jul 2022 06:48:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uPt9ZU0DE+MKVlmzvtHZPz5QWqD5lpMmIVb/Eim5RZShJDxyhWQfmOpdVTCK/okyE/bXU5 X-Received: by 2002:a17:906:8462:b0:72b:4e05:a8c1 with SMTP id hx2-20020a170906846200b0072b4e05a8c1mr29912151ejc.443.1658238484456; Tue, 19 Jul 2022 06:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238484; cv=none; d=google.com; s=arc-20160816; b=EtgihGHNCxNHy/mwW55Eh7hSAL0vYPJY5h5rdxTxQFm7K2erUyOY0n6FOwFYedlE2M h4pupRNb0VNVUbSyoNV6J+1Nswf+qfTdcOPb+t/0Og54GG4aBGmRD+Txdstms9spGFbK Mu7jB0od9fbZ8D38ZHRhHnyMveDIDpdWAO+EQeY7fVazumisN5ZTTl1FxgknZFS9S2EN ApTZt3CJ66awxw+9oikHpzWKOaBgLjQyMAr1Qc2g31AG5LH8zfdhZixusCYGsbSCq1i6 lbCquQMY2HoNLXG1aQKcypSTHPQ0Pg/uqCpM4+yLKj5ccfKTaN71fLRPlesKCSMHZwhB MP6A== 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=2b7DkQLYVQvZ2IRhS8VVr9AH4p+H+JYewIpZUsxKe10=; b=mRYonBq9YgkqmWXJjtDnLijKr4FtrFcT3r9KgktgNNbVYLuHaoHp7v7nlMcy5ZgPzl kaDimy/mJabEyO2C9qWO1Jxe680SQj56/0qr1gqiYbVWB1oBKDtD26zZjjSamI6BRcGB eXGSQTu7rTAhj0b/DujzeVH9XMnv4x2xL8lgZdMV+5R96G6dBqE21/sB2uiVMExP/VdD OxeKfFjSRlg2ryTA+ItBgGUOd7ixqs37ZsyKp1QlTLIxdnPHLaWPtQ08qxCFa65lFuJQ a7Jq1Ba6zZIyWDFmUKPV7jRFWIJGQTIkIbixvT5BHN6zCMu38bALHHUE1P/LmaaIsnOQ SLBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jAivdXXh; 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 t17-20020aa7d711000000b0043adae91e5csi17012173edq.611.2022.07.19.06.47.39; Tue, 19 Jul 2022 06:48:04 -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=jAivdXXh; 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 S241387AbiGSMlK (ORCPT + 99 others); Tue, 19 Jul 2022 08:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241287AbiGSMjT (ORCPT ); Tue, 19 Jul 2022 08:39:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ED6141D31; Tue, 19 Jul 2022 05:15:40 -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 sin.source.kernel.org (Postfix) with ESMTPS id 60B5BCE1BD6; Tue, 19 Jul 2022 12:15:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53FB6C341C6; Tue, 19 Jul 2022 12:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232936; bh=4Ae9WzvhYzV9DqfC1sH5vWDfWr4NdbtZgH8jm50vzHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAivdXXhZJo9JAj7yIce1PrgInTx0xHt3C310/2aZ1CEfxpvpxgt1hh8JgfB2AMOJ dQIX13KTSexNBwkuIbgQepTfUY1LFWjFidM6s60DqOG5hKdgYQehEQALWlezG+onxh PEChvQpZwFetzYSWb2Ucu3JybYQeTZegF0IatJwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 094/167] net: stmmac: fix leaks in probe Date: Tue, 19 Jul 2022 13:53:46 +0200 Message-Id: <20220719114705.592488765@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@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.8 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 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: Dan Carpenter [ Upstream commit 23aa6d5088e3bd65de77c5c307237b9937f8b48a ] These two error paths should clean up before returning. Fixes: 2bb4b98b60d7 ("net: stmmac: Add Ingenic SoCs MAC support.") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c index 9a6d819b84ae..378b4dd826bb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -273,7 +273,8 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->tx_delay = tx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid TX clock delay: %dps\n", tx_delay_ps); - return -EINVAL; + ret = -EINVAL; + goto err_remove_config_dt; } } @@ -283,7 +284,8 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->rx_delay = rx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid RX clock delay: %dps\n", rx_delay_ps); - return -EINVAL; + ret = -EINVAL; + goto err_remove_config_dt; } } -- 2.35.1