From nobody Wed Nov 27 21:37:49 2024 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 ED0687DA76; Tue, 8 Oct 2024 09:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378722; cv=none; b=jkxvpULYDo/yovhhLUOen3Mr6GHsgk2GFkOUNnEZpSb9Ss218OX5J9VNfqCEAteyhADK1RTM0Sor2RxWE6ic76IeQO99nngKVTSj3XdjDEomn4mK0pkRSanhOUQByc4AvgLa4Fc0VpYOmLgJA5wTAWiXjNdnwwPRE2WaXNLDIUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378722; c=relaxed/simple; bh=psWv/GQWq/bwZDujqdjpK14Oh7RYTn3S4SaIUCbXiIQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YWtM9HTeU52FzUB4SJBMk8ylKOhIkJoD4SnemaPSxEcVrYPAoy7VAwoiWUwOGtxU3IDH8uQBYu0WL2bRvdDo3jAVRRAJ5lXTSUwTL4eSQYXTZTqrySgNjstntR/pKJ7RgJfUmGeeecZwDIZkfxdvYhBgtuh2Aey9meIfjOPHuz8= 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.255 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 szxga08-in.huawei.com (SkyGuard) with ESMTP id 4XN9GH1ZQGz1P9Yx; Tue, 8 Oct 2024 17:10:15 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 2388F18005F; Tue, 8 Oct 2024 17:11:57 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 8 Oct 2024 17:11:56 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , CC: Subject: [PATCH v5 2/2] net: lan743x: Remove duplicate check Date: Tue, 8 Oct 2024 17:11:01 +0800 Message-ID: <20241008091101.713898-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008091101.713898-1-ruanjinjie@huawei.com> References: <20241008091101.713898-1-ruanjinjie@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: quoted-printable X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemh500013.china.huawei.com (7.202.181.146) Content-Type: text/plain; charset="utf-8" Since timespec64_valid() has been checked in higher layer pc_clock_settime(), the duplicate check in lan743x_ptpci_settime64() can be removed. Signed-off-by: Jinjie Ruan --- v4: - Update the commit message. v2: - Check it in ptp core instead of using NSEC_PER_SEC macro. - Remove the NULL check. --- drivers/net/ethernet/microchip/lan743x_ptp.c | 35 ++++++++------------ 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.c b/drivers/net/eth= ernet/microchip/lan743x_ptp.c index dcea6652d56d..4a777b449ecd 100644 --- a/drivers/net/ethernet/microchip/lan743x_ptp.c +++ b/drivers/net/ethernet/microchip/lan743x_ptp.c @@ -401,28 +401,21 @@ static int lan743x_ptpci_settime64(struct ptp_clock_i= nfo *ptpci, u32 nano_seconds =3D 0; u32 seconds =3D 0; =20 - if (ts) { - if (ts->tv_sec > 0xFFFFFFFFLL || - ts->tv_sec < 0) { - netif_warn(adapter, drv, adapter->netdev, - "ts->tv_sec out of range, %lld\n", - ts->tv_sec); - return -ERANGE; - } - if (ts->tv_nsec >=3D 1000000000L || - ts->tv_nsec < 0) { - netif_warn(adapter, drv, adapter->netdev, - "ts->tv_nsec out of range, %ld\n", - ts->tv_nsec); - return -ERANGE; - } - seconds =3D ts->tv_sec; - nano_seconds =3D ts->tv_nsec; - lan743x_ptp_clock_set(adapter, seconds, nano_seconds, 0); - } else { - netif_warn(adapter, drv, adapter->netdev, "ts =3D=3D NULL\n"); - return -EINVAL; + if (ts->tv_sec > 0xFFFFFFFFLL) { + netif_warn(adapter, drv, adapter->netdev, + "ts->tv_sec out of range, %lld\n", + ts->tv_sec); + return -ERANGE; + } + if (ts->tv_nsec < 0) { + netif_warn(adapter, drv, adapter->netdev, + "ts->tv_nsec out of range, %ld\n", + ts->tv_nsec); + return -ERANGE; } + seconds =3D ts->tv_sec; + nano_seconds =3D ts->tv_nsec; + lan743x_ptp_clock_set(adapter, seconds, nano_seconds, 0); =20 return 0; } --=20 2.34.1