treewide: Remove unneeded else statements

The code is more readable without the unnecessary nesting
This commit is contained in:
Denis Kenzior 2022-01-11 11:00:15 -06:00
parent b44460464e
commit 073346ee37
6 changed files with 23 additions and 20 deletions

View File

@ -1707,8 +1707,9 @@ static struct l_dbus_message *dpp_dbus_start_enrollee(struct l_dbus *dbus,
if (station && station_get_connected_network(station)) { if (station && station_get_connected_network(station)) {
l_warn("cannot be enrollee while connected, please disconnect"); l_warn("cannot be enrollee while connected, please disconnect");
return dbus_error_busy(message); return dbus_error_busy(message);
} else }
l_debug("No station device, continuing anyways...");
l_debug("No station device, continuing anyways...");
dpp->uri = dpp_generate_uri(dpp->pub_asn1, dpp->pub_asn1_len, 2, dpp->uri = dpp_generate_uri(dpp->pub_asn1, dpp->pub_asn1_len, 2,
netdev_get_address(dpp->netdev), &freq, netdev_get_address(dpp->netdev), &freq,

View File

@ -2389,12 +2389,12 @@ static void eapol_eap_complete_cb(enum eap_result result, void *user_data)
sm->eap = NULL; sm->eap = NULL;
handshake_failed(sm, MMPDU_REASON_CODE_IEEE8021X_FAILED); handshake_failed(sm, MMPDU_REASON_CODE_IEEE8021X_FAILED);
return; return;
} else {
if (install_pmk)
install_pmk(sm->handshake, sm->handshake->pmk,
sm->handshake->pmk_len);
} }
if (install_pmk)
install_pmk(sm->handshake, sm->handshake->pmk,
sm->handshake->pmk_len);
eap_reset(sm->eap); eap_reset(sm->eap);
if (sm->handshake->authenticator) { if (sm->handshake->authenticator) {

View File

@ -996,8 +996,8 @@ bool network_bss_add(struct network *network, struct scan_bss *bss)
/* Done if BSS is not HS20 or we already have network_info set */ /* Done if BSS is not HS20 or we already have network_info set */
if (!bss->hs20_capable) if (!bss->hs20_capable)
return true; return true;
else
network->is_hs20 = true; network->is_hs20 = true;
if (network->info) if (network->info)
return true; return true;

View File

@ -1597,8 +1597,9 @@ static void p2p_peer_provision_done(int err, struct wsc_credentials_info *creds,
p2p_connection_reset(dev); p2p_connection_reset(dev);
return; return;
} else }
goto error;
goto error;
} }
if (strlen(creds[0].ssid) != bss->ssid_len || if (strlen(creds[0].ssid) != bss->ssid_len ||

View File

@ -237,9 +237,10 @@ static int station_autoconnect_next(struct station *station)
} }
return 0; return 0;
} else }
l_debug("autoconnect: network_autoconnect: %s (%d)",
strerror(-r), r); l_debug("autoconnect: network_autoconnect: %s (%d)",
strerror(-r), r);
} }
return -ENOENT; return -ENOENT;

View File

@ -209,14 +209,14 @@ static bool wiphy_can_connect_sae(struct wiphy *wiphy)
* TODO: No support for CMD_EXTERNAL_AUTH yet. * TODO: No support for CMD_EXTERNAL_AUTH yet.
*/ */
return false; return false;
} else {
/* Case (2) */
if (wiphy_has_ext_feature(wiphy,
NL80211_EXT_FEATURE_SAE_OFFLOAD))
return true;
return false;
} }
/* Case (2) */
if (wiphy_has_ext_feature(wiphy,
NL80211_EXT_FEATURE_SAE_OFFLOAD))
return true;
return false;
} }
enum ie_rsn_akm_suite wiphy_select_akm(struct wiphy *wiphy, enum ie_rsn_akm_suite wiphy_select_akm(struct wiphy *wiphy,