Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp531460lqh; Tue, 7 May 2024 06:50:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgw3vVrziEslJE9znuWCSlCSqTjBwjCMu1rWVhA5dkT0kY8KuqDEfK545UCRq7YEJQ8tdZftRTzypx2SuIbkkoBhILSbRvAnS2ZMAWFw== X-Google-Smtp-Source: AGHT+IH4xq8q8bxvoPeNYTuSfQei2JeK1yz8pPMOy+1Xc54jnvQ2rm3QlK40hnLeG/pr7T+2fqKw X-Received: by 2002:a05:6830:1bc3:b0:6ef:8860:b329 with SMTP id v3-20020a0568301bc300b006ef8860b329mr15602800ota.25.1715089840999; Tue, 07 May 2024 06:50:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715089840; cv=pass; d=google.com; s=arc-20160816; b=jwGIyUJFWFpfphzcCY+UnIHLCvL2Dsek6lp02/ghu1BtnZ5Ez7DQM+ymC5ZxJMFbXp JxF/ugi5b/eNYUM7drGHdZgrKhEl0i/UHKnCNa18LipTKYDFASNzNCfBpISYa/+eofub PraJXiv5QA1pwmouMZudrYJ7zPAAHSUztawglZ4iPzQB+lXJAIgyCdljFHWKv8PmDBim TTsq5vglIOpFgUWm6RbfP6F9rcfDapTDuhzNQd+s4Jp0wShtLz8n5XMn1eBQ9c4aKQbE yjbqD38JSsc4M1XPfWyNrQf+zpbm+lrXyujb5sbVjYP9VW0gyny1O77e2CwXf2ef64m+ YcmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=fNOjCqQlimP4RLJ0+0W4qlpn5j9MEwfpw9emezbfiUA=; fh=mENY5E4eClWonIkCOtlFWWTx/Dt7WFkfxCrepuo/4GQ=; b=EHe4xKe/vDVG+P6XWkjPPE9TE3My/MAfrGfwG9wMPUw2pnfLRTkbf7LoXJPF3APUiL 6zOsEPbBVdZ7DqB0T6VY/byTsNr4E9hRAGzL6ShfaTZeeqR2OWIwyEBq/VOSb8Yddx+k RmoRYMtST6nPiyREFjFE7GP/9c+FRojEwMZxnGsZ/XrQnFHqx+qZNOsyvShnxT7bkzza 03aI1c9DgAeAigretlK/2fQ9r4s7kyKC6XEuxyfeVM1JIz1ZRlLSbdz6QtGPL/FQLvdt PTt2trJSpIKD2mtzeeWmNC+bHTEM03XKPz8i4YkH4O9TtSyOjxL+2vrpuPna0iFAbaZL MyVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-171463-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b7-20020a05620a04e700b007929a20041dsi4315793qkh.252.2024.05.07.06.50.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:50:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171463-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-171463-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B57611C21BC4 for ; Tue, 7 May 2024 13:50:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 705FF15ECF3; Tue, 7 May 2024 13:49:56 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7F0115B128; Tue, 7 May 2024 13:49:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715089795; cv=none; b=GCeCMaPvLz+rYkhBY8a3MCFkslmKRBlrzuVsyE6a67WiNSG8k2ECKNyBAWaj7lsaLDq77z5NvPVWXHEtKRBp7cmgG0THWpwqz8l1Yhnew6u2gGam9qE7JjDVlu/ttHEliT4p+Tj6JdmUG1ll7bQqxJxo9n3mnw2AhpIQTQ6p3JY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715089795; c=relaxed/simple; bh=Er8lywoBRvvPKkaPq7no//gWKCJG4PMOTUPvGkQyG9A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ryYIzlkL5GLsnZXRJD+oiAWrjjBM7QpOBjjlRwFq499COsQKdeczlNRDwWxezgyonHj8srKlFsBPRLs3gQzMWL5Uv6rWnmzMZ5OYMoQMOAcEXaYGWdraP+/ELCJnEb4JYQWQxn/qhIIQxF5Jr20SxXEkoEc33X5k1Q6PsRJxTzU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VYfh23PX6ztT3Y; Tue, 7 May 2024 21:46:26 +0800 (CST) Received: from kwepemm600007.china.huawei.com (unknown [7.193.23.208]) by mail.maildlp.com (Postfix) with ESMTPS id 9B80E180065; Tue, 7 May 2024 21:49:51 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 7 May 2024 21:49:50 +0800 From: Jijie Shao To: , , , , , , , CC: , , , , , , Subject: [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed Date: Tue, 7 May 2024 21:42:21 +0800 Message-ID: <20240507134224.2646246-5-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20240507134224.2646246-1-shaojijie@huawei.com> References: <20240507134224.2646246-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600007.china.huawei.com (7.193.23.208) From: Peiyang Wang During the PF initialization process, hclge_update_port_info may return an error code for some reason. At this point, the ptp initialization has been completed. To void memory leaks, the resources that are applied by ptp should be released. Therefore, when hclge_update_port_info returns an error code, hclge_ptp_uninit is called to release the corresponding resources. Fixes: eaf83ae59e18 ("net: hns3: add querying fec ability from firmware") Signed-off-by: Peiyang Wang Signed-off-by: Jijie Shao Reviewed-by: Hariprasad Kelam --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index ecff9b426527..1d255b3ae988 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -11764,7 +11764,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ret = hclge_update_port_info(hdev); if (ret) - goto err_mdiobus_unreg; + goto err_ptp_uninit; INIT_KFIFO(hdev->mac_tnl_log); @@ -11815,6 +11815,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) devl_unlock(hdev->devlink); return 0; +err_ptp_uninit: + hclge_ptp_uninit(hdev); err_mdiobus_unreg: if (hdev->hw.mac.phydev) mdiobus_unregister(hdev->hw.mac.mdio_bus); -- 2.30.0