]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: hns3: disable interrupt when ptp init failed
authorYonglong Liu <liuyonglong@huawei.com>
Tue, 22 Jul 2025 12:54:21 +0000 (20:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Aug 2025 08:47:29 +0000 (09:47 +0100)
[ Upstream commit cde304655f25d94a996c45b0f9956e7dcc2bc4c0 ]

When ptp init failed, we'd better disable the interrupt and clear the
flag, to avoid early report interrupt at next probe.

Fixes: 0bf5eb788512 ("net: hns3: add support for PTP")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250722125423.1270673-3-shaojijie@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c

index 9a806ac727cf5bebc17a553417cf582e782e34da..c1e88e67ebb657b54819d81f032bfa2b89a420e9 100644 (file)
@@ -497,14 +497,14 @@ int hclge_ptp_init(struct hclge_dev *hdev)
        if (ret) {
                dev_err(&hdev->pdev->dev,
                        "failed to init freq, ret = %d\n", ret);
-               goto out;
+               goto out_clear_int;
        }
 
        ret = hclge_ptp_set_ts_mode(hdev, &hdev->ptp->ts_cfg);
        if (ret) {
                dev_err(&hdev->pdev->dev,
                        "failed to init ts mode, ret = %d\n", ret);
-               goto out;
+               goto out_clear_int;
        }
 
        ktime_get_real_ts64(&ts);
@@ -512,7 +512,7 @@ int hclge_ptp_init(struct hclge_dev *hdev)
        if (ret) {
                dev_err(&hdev->pdev->dev,
                        "failed to init ts time, ret = %d\n", ret);
-               goto out;
+               goto out_clear_int;
        }
 
        set_bit(HCLGE_STATE_PTP_EN, &hdev->state);
@@ -520,6 +520,9 @@ int hclge_ptp_init(struct hclge_dev *hdev)
 
        return 0;
 
+out_clear_int:
+       clear_bit(HCLGE_PTP_FLAG_EN, &hdev->ptp->flags);
+       hclge_ptp_int_en(hdev, false);
 out:
        hclge_ptp_destroy_clock(hdev);