Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c0a47db authored by George Burgess IV's avatar George Burgess IV Committed by Les Lee
Browse files

wifi: fix a use of an uninitialized value

This `if` is executed once, so using `legacy_status` from a prior
execution is nonsensical.

Caught by the static analyzer:
> hardware/interfaces/wifi/1.5/default/wifi_chip.cpp:1053:39: warning:
1st function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: 173999527
Test: atest -c VtsHalWifiApV1_5TargetTest
Merged-In: Ib81f1496be53e453d9c99ede129a77bdaf860de7
Change-Id: Ib81f1496be53e453d9c99ede129a77bdaf860de7
parent 3e44dd3f
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1036,7 +1036,6 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) {

WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal(
    const std::string& ifname, const std::string& ifInstanceName) {
    legacy_hal::wifi_error legacy_status;
    const auto iface = findUsingName(ap_ifaces_, ifname);
    if (!iface.get() || ifInstanceName.empty()) {
        return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
@@ -1048,13 +1047,13 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal(
                if (iface == ifInstanceName) {
                    if (!iface_util_.lock()->removeIfaceFromBridge(it.first,
                                                                   iface)) {
                        LOG(ERROR) << "Failed to remove interface: " << iface
                                   << " from " << ifname << ", error: "
                                   << legacyErrorToString(legacy_status);
                        LOG(ERROR)
                            << "Failed to remove interface: " << ifInstanceName
                            << " from " << ifname;
                        return createWifiStatus(
                            WifiStatusCode::ERROR_NOT_AVAILABLE);
                    }
                    legacy_status =
                    legacy_hal::wifi_error legacy_status =
                        legacy_hal_.lock()->deleteVirtualInterface(iface);
                    if (legacy_status != legacy_hal::WIFI_SUCCESS) {
                        LOG(ERROR) << "Failed to del interface: " << iface