| 1 | --- a/src/ap/hostapd.c |
| 2 | +++ b/src/ap/hostapd.c |
| 3 | @@ -886,11 +886,8 @@ int hostapd_setup_interface_complete(str |
| 4 | size_t j; |
| 5 | u8 *prev_addr; |
| 6 | |
| 7 | - if (err) { |
| 8 | - wpa_printf(MSG_ERROR, "Interface initialization failed"); |
| 9 | - eloop_terminate(); |
| 10 | - return -1; |
| 11 | - } |
| 12 | + if (err) |
| 13 | + goto error; |
| 14 | |
| 15 | wpa_printf(MSG_DEBUG, "Completing interface initialization"); |
| 16 | if (hapd->iconf->channel) { |
| 17 | @@ -906,7 +903,7 @@ int hostapd_setup_interface_complete(str |
| 18 | hapd->iconf->secondary_channel)) { |
| 19 | wpa_printf(MSG_ERROR, "Could not set channel for " |
| 20 | "kernel driver"); |
| 21 | - return -1; |
| 22 | + goto error; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | @@ -917,7 +914,7 @@ int hostapd_setup_interface_complete(str |
| 27 | hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, |
| 28 | HOSTAPD_LEVEL_WARNING, |
| 29 | "Failed to prepare rates table."); |
| 30 | - return -1; |
| 31 | + goto error; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | @@ -925,14 +922,14 @@ int hostapd_setup_interface_complete(str |
| 36 | hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { |
| 37 | wpa_printf(MSG_ERROR, "Could not set RTS threshold for " |
| 38 | "kernel driver"); |
| 39 | - return -1; |
| 40 | + goto error; |
| 41 | } |
| 42 | |
| 43 | if (hapd->iconf->fragm_threshold > -1 && |
| 44 | hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) { |
| 45 | wpa_printf(MSG_ERROR, "Could not set fragmentation threshold " |
| 46 | "for kernel driver"); |
| 47 | - return -1; |
| 48 | + goto error; |
| 49 | } |
| 50 | |
| 51 | prev_addr = hapd->own_addr; |
| 52 | @@ -942,7 +939,7 @@ int hostapd_setup_interface_complete(str |
| 53 | if (j) |
| 54 | os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); |
| 55 | if (hostapd_setup_bss(hapd, j == 0)) |
| 56 | - return -1; |
| 57 | + goto error; |
| 58 | if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) |
| 59 | prev_addr = hapd->own_addr; |
| 60 | } |
| 61 | @@ -954,7 +951,7 @@ int hostapd_setup_interface_complete(str |
| 62 | if (hostapd_driver_commit(hapd) < 0) { |
| 63 | wpa_printf(MSG_ERROR, "%s: Failed to commit driver " |
| 64 | "configuration", __func__); |
| 65 | - return -1; |
| 66 | + goto error; |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | @@ -975,6 +972,11 @@ int hostapd_setup_interface_complete(str |
| 71 | iface->bss[0]->conf->iface); |
| 72 | |
| 73 | return 0; |
| 74 | + |
| 75 | +error: |
| 76 | + wpa_printf(MSG_ERROR, "Interface initialization failed"); |
| 77 | + eloop_terminate(); |
| 78 | + return -1; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | |