Commit ea531dc6 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Jakub Kicinski

net: lan743x: Remove duplicate check

Since timespec64_valid() has been checked in higher layer
pc_clock_settime(), the duplicate check in lan743x_ptpci_settime64()
can be removed.
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Link: https://patch.msgid.link/20241009072302.1754567-3-ruanjinjie@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d8794ac2
......@@ -401,28 +401,21 @@ static int lan743x_ptpci_settime64(struct ptp_clock_info *ptpci,
u32 nano_seconds = 0;
u32 seconds = 0;
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 >= 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 = ts->tv_sec;
nano_seconds = ts->tv_nsec;
lan743x_ptp_clock_set(adapter, seconds, nano_seconds, 0);
} else {
netif_warn(adapter, drv, adapter->netdev, "ts == 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 = ts->tv_sec;
nano_seconds = ts->tv_nsec;
lan743x_ptp_clock_set(adapter, seconds, nano_seconds, 0);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment