From 358a2bbedb279a42b0c90f53b9df9849925e38cd Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Mon, 24 Jan 2022 10:38:37 -0800 Subject: [PATCH] Remove never-reached 'return' statements We style Nfc::open() to be similar to Nfc::close(), allowing us to remove two never-reached 'return' statements, and help avoid potential confusion with future readers of the code. Test: TreeHugger Bug: 204868826 Change-Id: Ieabdfbb95540cafaf00a16955f26344c92d2d482 --- nfc/aidl/default/Nfc.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/nfc/aidl/default/Nfc.cpp b/nfc/aidl/default/Nfc.cpp index a31ac5ec8e..4685b59236 100644 --- a/nfc/aidl/default/Nfc.cpp +++ b/nfc/aidl/default/Nfc.cpp @@ -42,24 +42,21 @@ void OnDeath(void* cookie) { LOG(INFO) << "Nfc::open null callback"; return ndk::ScopedAStatus::fromServiceSpecificError( static_cast(NfcStatus::FAILED)); - } else { - Nfc::mCallback = clientCallback; - - clientDeathRecipient = AIBinder_DeathRecipient_new(OnDeath); - auto linkRet = AIBinder_linkToDeath(clientCallback->asBinder().get(), clientDeathRecipient, - this /* cookie */); - if (linkRet != STATUS_OK) { - LOG(ERROR) << __func__ << ": linkToDeath failed: " << linkRet; - // Just ignore the error. - } - - int ret = Vendor_hal_open(eventCallback, dataCallback); - return ret == 0 ? ndk::ScopedAStatus::ok() - : ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(NfcStatus::FAILED)); - return ndk::ScopedAStatus::ok(); } - return ndk::ScopedAStatus::ok(); + Nfc::mCallback = clientCallback; + + clientDeathRecipient = AIBinder_DeathRecipient_new(OnDeath); + auto linkRet = AIBinder_linkToDeath(clientCallback->asBinder().get(), clientDeathRecipient, + this /* cookie */); + if (linkRet != STATUS_OK) { + LOG(ERROR) << __func__ << ": linkToDeath failed: " << linkRet; + // Just ignore the error. + } + + int ret = Vendor_hal_open(eventCallback, dataCallback); + return ret == 0 ? ndk::ScopedAStatus::ok() + : ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(NfcStatus::FAILED)); } ::ndk::ScopedAStatus Nfc::close(NfcCloseType type) {