Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4454176imw; Tue, 19 Jul 2022 06:58:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tfbzJtrvzLXieZpl+FC4jPnEE2XIK66m5qUyEclMiuKzHPw0+uAJK2nY0oRxj+b9varDLF X-Received: by 2002:a05:6402:c44:b0:431:52cc:f933 with SMTP id cs4-20020a0564020c4400b0043152ccf933mr44037991edb.41.1658239104426; Tue, 19 Jul 2022 06:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658239104; cv=none; d=google.com; s=arc-20160816; b=nC9E92OS9w5MGpb5kY7/sF+JojEoaifMIlTZ4i0vsjAVOLPLt8MlOvSOn6w0zpEJTA UUVth/uWvEtzcOcl8PFtQopZuhqZVds7v28TInnaUrt+5PikxribFw+rnM/0xA2P7Aco 3qjRzPDYqLlGkAr3ZBxSPL6NPDSAq37OhMpuL6Cm20k8d54N8W7uM2oOWlneTWR0CkQH 5XCHGAkUMt9Cx04OArY8HQ4E/x0/uEAKM76lIJAhJueawR9QAcuNa3thpqTG60ZhYRSq aWvhlkPcbBcuv2WgxRDs4nU7p8Twq8dAxA+wHpXG9VMQMSQ9kOgrlgEwvsA26B4qWNiJ sdew== 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=I6h0kTLUUXT05XJ6gZ4wTQIQXxTab65LQlGNPnDB0gfEBbzGxvxNdRgYTusbMfwtpD dlsOw6V0muB6KUXAaYU5jDC4jLRJhPlaxcnCud6QmhOytM2aOb33vD33Nqng3YRLyAvM p5BJLUiK+PVNOYf5m4nyXDNimzvLM8CHU7VURD7HPuQKuFT7mjfDmFw5bE0Av4A9whfF Oz55kXlwR8TG+EO25JPtzLHr78SiDxP8VyeK9ef3M5aiDotGGke5FqnIX0MEOdegwn2x HWn+nSTq4HjENdh9UiqqVcXmlneI8xYyl7lvvmNCz5y4SFEdAH1Tn2W1mMUx8APVfMqK 4ZgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=or90O26U; 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 b4-20020a50ccc4000000b0043af55e1f03si14281433edj.259.2022.07.19.06.57.53; Tue, 19 Jul 2022 06:58:24 -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=or90O26U; 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 S242811AbiGSNCu (ORCPT + 99 others); Tue, 19 Jul 2022 09:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243033AbiGSNAI (ORCPT ); Tue, 19 Jul 2022 09:00:08 -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 69D5B60697; Tue, 19 Jul 2022 05:25:30 -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 7104CB81B21; Tue, 19 Jul 2022 12:25:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D647DC341CB; Tue, 19 Jul 2022 12:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233527; bh=4Ae9WzvhYzV9DqfC1sH5vWDfWr4NdbtZgH8jm50vzHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=or90O26Uq3doL5sixqECZLD7q6fa9O9r5zpWg0OaoxT2mmagojxyu+6r9vuJq5hUY vQms5nvLoIRp3rwXA2tyxi8Y58GXFKw8QJEz8v9FEYey3phpOuKNfl9N8gEazWEQ85 Y08yhjbYnjHXQZZMmg9u2wevx2LdDyg+q4Fw2IJg= 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.18 125/231] net: stmmac: fix leaks in probe Date: Tue, 19 Jul 2022 13:53:30 +0200 Message-Id: <20220719114724.968377404@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@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