|
@@ -1601,7 +1601,7 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
#ifdef ATH6K_CONFIG_CFG80211
|
|
|
struct wireless_dev *wdev;
|
|
|
#endif /* ATH6K_CONFIG_CFG80211 */
|
|
|
- int init_status = 0;
|
|
|
+ int r = 0;
|
|
|
struct hif_device_os_device_info osDevInfo;
|
|
|
|
|
|
memset(&osDevInfo, 0, sizeof(osDevInfo));
|
|
@@ -1722,28 +1722,25 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
{
|
|
|
struct bmi_target_info targ_info;
|
|
|
|
|
|
- if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != 0) {
|
|
|
- init_status = A_ERROR;
|
|
|
+ r = BMIGetTargetInfo(ar->arHifDevice, &targ_info);
|
|
|
+ if (r)
|
|
|
goto avail_ev_failed;
|
|
|
- }
|
|
|
|
|
|
ar->arVersion.target_ver = targ_info.target_ver;
|
|
|
ar->arTargetType = targ_info.target_type;
|
|
|
|
|
|
- /* do any target-specific preparation that can be done through BMI */
|
|
|
- if (ar6000_prepare_target(ar->arHifDevice,
|
|
|
+ /* do any target-specific preparation that can be done through BMI */
|
|
|
+ r = ar6000_prepare_target(ar->arHifDevice,
|
|
|
targ_info.target_type,
|
|
|
- targ_info.target_ver) != 0) {
|
|
|
- init_status = A_ERROR;
|
|
|
+ targ_info.target_ver);
|
|
|
+ if (r)
|
|
|
goto avail_ev_failed;
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (ar6000_configure_target(ar) != 0) {
|
|
|
- init_status = A_ERROR;
|
|
|
+ r = ar6000_configure_target(ar);
|
|
|
+ if (r)
|
|
|
goto avail_ev_failed;
|
|
|
- }
|
|
|
|
|
|
A_MEMZERO(&htcInfo,sizeof(htcInfo));
|
|
|
htcInfo.pContext = ar;
|
|
@@ -1751,8 +1748,8 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
|
|
|
ar->arHtcTarget = HTCCreate(ar->arHifDevice,&htcInfo);
|
|
|
|
|
|
- if (ar->arHtcTarget == NULL) {
|
|
|
- init_status = A_ERROR;
|
|
|
+ if (!ar->arHtcTarget) {
|
|
|
+ r = -ENOMEM;
|
|
|
goto avail_ev_failed;
|
|
|
}
|
|
|
|
|
@@ -1771,9 +1768,10 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
#endif
|
|
|
|
|
|
#ifdef ATH_AR6K_11N_SUPPORT
|
|
|
- if((ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs)) == NULL) {
|
|
|
+ ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs);
|
|
|
+ if (!ar->aggr_cntxt) {
|
|
|
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize aggr.\n", __func__));
|
|
|
- init_status = A_ERROR;
|
|
|
+ r = -ENOMEM;
|
|
|
goto avail_ev_failed;
|
|
|
}
|
|
|
|
|
@@ -1790,9 +1788,9 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
|
|
|
if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
|
|
|
(wlaninitmode == WLAN_INIT_MODE_DRV)) {
|
|
|
- int status = 0;
|
|
|
do {
|
|
|
- if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) {
|
|
|
+ r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode);
|
|
|
+ if (r) {
|
|
|
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n"));
|
|
|
break;
|
|
|
}
|
|
@@ -1802,24 +1800,23 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
}
|
|
|
#endif
|
|
|
rtnl_lock();
|
|
|
- status = (ar6000_init(dev)==0) ? 0 : A_ERROR;
|
|
|
+ r = ar6000_init(dev);
|
|
|
rtnl_unlock();
|
|
|
- if (status) {
|
|
|
+ if (r) {
|
|
|
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
|
|
|
}
|
|
|
} while (false);
|
|
|
|
|
|
- if (status) {
|
|
|
- init_status = status;
|
|
|
+ if (r)
|
|
|
goto avail_ev_failed;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/* This runs the init function if registered */
|
|
|
- if (register_netdev(dev)) {
|
|
|
+ r = register_netdev(dev);
|
|
|
+ if (r) {
|
|
|
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n"));
|
|
|
ar6000_destroy(dev, 0);
|
|
|
- return A_ERROR;
|
|
|
+ return r;
|
|
|
}
|
|
|
|
|
|
is_netdev_registered = 1;
|
|
@@ -1832,10 +1829,10 @@ ar6000_avail_ev(void *context, void *hif_handle)
|
|
|
(unsigned long)ar));
|
|
|
|
|
|
avail_ev_failed :
|
|
|
- if (init_status)
|
|
|
+ if (r)
|
|
|
ar6000_sysfs_bmi_deinit(ar);
|
|
|
|
|
|
- return init_status;
|
|
|
+ return r;
|
|
|
}
|
|
|
|
|
|
static void ar6000_target_failure(void *Instance, int Status)
|