Skip to content

Commit

Permalink
ath6kl: propagate error values on ar6000_avail_ev()
Browse files Browse the repository at this point in the history
When something fails we set up some generic error values,
instead keep the values from the callers and make sure to
pass them on.

Cc: Naveen Singh <nsingh@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Luis R. Rodriguez authored and Greg Kroah-Hartman committed Apr 5, 2011
1 parent eb60cfa commit c1ccd08
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions drivers/staging/ath6kl/os/linux/ar6000_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -1722,37 +1722,34 @@ 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;
htcInfo.TargetFailure = ar6000_target_failure;

ar->arHtcTarget = HTCCreate(ar->arHifDevice,&htcInfo);

if (ar->arHtcTarget == NULL) {
init_status = A_ERROR;
if (!ar->arHtcTarget) {
r = -ENOMEM;
goto avail_ev_failed;
}

Expand All @@ -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;
}

Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit c1ccd08

Please sign in to comment.