From nobody Tue Dec 16 19:42:57 2025 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 2E6741ACEDB; Fri, 28 Feb 2025 11:00: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=1740740457; cv=none; b=oUjkNb10YbTjwePVkIuYOVmC2hcXI47xuvMQas7LSleuUYPTK1jVFVc5R1mCUALfrNnhNuajhuXy5b8tBVkXJ788xFJE3MedHKDKgPQ2zpquDnCGNl+CIZd7KxTjK9LA9eV+TjKWiglpkNOgzHvitVGGlnyoMKQiNNsG4TSrLVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740740457; c=relaxed/simple; bh=fy0rrOyVDewDPklbCqvdhOp3juLTfjm0e3sk1PpGsj0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=ilw3LcDDHPlF1zOgTPTIM42ePImQRDc6+CVS/sqML0Oe5HhgFlrZAmJXxhEEFbD+4k0XZZ60qaNK3fcKxq+V/VAjFaczS076GqgpRAvQEhPHP16xKKr1yPtkIAFUVXIr3HEXPsF86OpjKKpcd3W9cVfO/CQK7jqhs4XZpEyupKI= 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.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Z44rM06kWzwXF5; Fri, 28 Feb 2025 18:56:03 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 059401800CD; Fri, 28 Feb 2025 19:00:51 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 28 Feb 2025 19:00:50 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH net] net: hns3: make sure ptp clock is unregister and freed if hclge_ptp_get_cycle returns an error Date: Fri, 28 Feb 2025 18:52:58 +0800 Message-ID: <20250228105258.1243461-1-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" From: Peiyang Wang During the initialization of ptp, hclge_ptp_get_cycle might return an error and returned directly without unregister clock and free it. To avoid that, call hclge_ptp_destroy_clock to unregist and free clock if hclge_ptp_get_cycle failed. Fixes: 8373cd38a888 ("net: hns3: change the method of obtaining default ptp= cycle") Signed-off-by: Peiyang Wang Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c index bab16c2191b2..181af419b878 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c @@ -483,7 +483,7 @@ int hclge_ptp_init(struct hclge_dev *hdev) =20 ret =3D hclge_ptp_get_cycle(hdev); if (ret) - return ret; + goto out; } =20 ret =3D hclge_ptp_int_en(hdev, true); --=20 2.33.0