From 1e5d81683843e16f9da71a57138c37abcbe5bc7d Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 8 May 2020 17:15:51 -0700 Subject: [PATCH] [address-resolver] change AddSnoopedCacheEntry() to return void (#4941) --- src/core/thread/address_resolver.cpp | 7 +++---- src/core/thread/address_resolver.hpp | 5 +---- src/core/thread/mesh_forwarder_ftd.cpp | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index d2d5d0d6b..c39c1efe1 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -398,14 +398,13 @@ exit: return error; } -otError AddressResolver::AddSnoopedCacheEntry(const Ip6::Address &aEid, Mac::ShortAddress aRloc16) +void AddressResolver::AddSnoopedCacheEntry(const Ip6::Address &aEid, Mac::ShortAddress aRloc16) { - otError error = OT_ERROR_NONE; uint16_t numNonEvictable = 0; CacheEntry *entry; entry = NewCacheEntry(/* aSnoopedEntry */ true); - VerifyOrExit(entry != NULL, error = OT_ERROR_NO_BUFS); + VerifyOrExit(entry != NULL, OT_NOOP); for (CacheEntry *snooped = mSnoopedList.GetHead(); snooped != NULL; snooped = snooped->GetNext()) { @@ -439,7 +438,7 @@ otError AddressResolver::AddSnoopedCacheEntry(const Ip6::Address &aEid, Mac::Sho LogCacheEntryChange(kEntryAdded, kReasonSnoop, *entry); exit: - return error; + return; } void AddressResolver::RestartAddressQueries(void) diff --git a/src/core/thread/address_resolver.hpp b/src/core/thread/address_resolver.hpp index 61381bba2..51f74fac2 100644 --- a/src/core/thread/address_resolver.hpp +++ b/src/core/thread/address_resolver.hpp @@ -146,11 +146,8 @@ public: * @param[in] aEid A reference to the EID. * @param[in] aRloc16 The RLOC16 corresponding to @p aEid. * - * @retval OT_ERROR_NONE Successfully adds the cache entry. - * @retval OT_ERROR_NO_BUFS Insufficient buffer space available to add one cache entry. - * */ - otError AddSnoopedCacheEntry(const Ip6::Address &aEid, Mac::ShortAddress aRloc16); + void AddSnoopedCacheEntry(const Ip6::Address &aEid, Mac::ShortAddress aRloc16); /** * This method returns the RLOC16 for a given EID, or initiates an Address Query if the mapping is not known. diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 1c6ac1a45..c39a72f29 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -716,7 +716,7 @@ void MeshForwarder::UpdateRoutes(const uint8_t * aFrame, (aMeshDest.GetShort() == Get().GetShortAddress() || Get().IsMinimalChild(aMeshDest.GetShort()))) { - IgnoreError(Get().AddSnoopedCacheEntry(ip6Header.GetSource(), aMeshSource.GetShort())); + Get().AddSnoopedCacheEntry(ip6Header.GetSource(), aMeshSource.GetShort()); } } }