From 0ccd979f23a1f7558c24cc7bccb34c9cf5045566 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Thu, 17 Nov 2022 09:27:41 -0800 Subject: [PATCH] examples: fix odd if sequence found by static analysis --- examples/rtl8720dn/ntpclient/main.go | 4 +--- examples/wifinina/ntpclient/main.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/rtl8720dn/ntpclient/main.go b/examples/rtl8720dn/ntpclient/main.go index 2d52d73..7149afc 100644 --- a/examples/rtl8720dn/ntpclient/main.go +++ b/examples/rtl8720dn/ntpclient/main.go @@ -100,9 +100,7 @@ func getCurrentTime(conn *net.UDPSerialConn) (time.Time, error) { } else if n == 0 { continue // no packet received yet } else if n != NTP_PACKET_SIZE { - if n != NTP_PACKET_SIZE { - return time.Time{}, fmt.Errorf("expected NTP packet size of %d: %d", NTP_PACKET_SIZE, n) - } + return time.Time{}, fmt.Errorf("expected NTP packet size of %d: %d", NTP_PACKET_SIZE, n) } return parseNTPpacket(), nil } diff --git a/examples/wifinina/ntpclient/main.go b/examples/wifinina/ntpclient/main.go index f983519..606e54b 100644 --- a/examples/wifinina/ntpclient/main.go +++ b/examples/wifinina/ntpclient/main.go @@ -111,9 +111,7 @@ func getCurrentTime(conn *net.UDPSerialConn) (time.Time, error) { } else if n == 0 { continue // no packet received yet } else if n != NTP_PACKET_SIZE { - if n != NTP_PACKET_SIZE { - return time.Time{}, fmt.Errorf("expected NTP packet size of %d: %d", NTP_PACKET_SIZE, n) - } + return time.Time{}, fmt.Errorf("expected NTP packet size of %d: %d", NTP_PACKET_SIZE, n) } return parseNTPpacket(), nil }