From 844d3ff2d76d02def2fa7a71e6f159898d9e94b9 Mon Sep 17 00:00:00 2001 From: Visweswara Tanuku Date: Tue, 21 Feb 2017 19:48:41 +0530 Subject: qcacld-2.0: Do proper cleanup when bmi download fails Handled cleanup of code when bmi_download_firmware fails. Ensured Async thread is killed when driver exits due to bmi error. Disabled SDIO func & Reset the SDIO when vos open fails, for automated tests to move ahead where the card does not need to be removed. Free all memory allocated by init during cleanup. Change-Id: I2d48c83d6105255157ddfbd5f0abbab59095129a CRs-Fixed: 2004564 --- CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c | 4 +++- CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c b/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c index 3786d71036c4..53392c301a93 100644 --- a/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c +++ b/CORE/SERVICES/HIF/sdio/linux/if_ath_sdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -265,6 +265,8 @@ ath_hif_sdio_probe(void *context, void *hif_handle) err_attach2: athdiag_procfs_remove(); + if (sc->ol_sc->ramdump_base) + hif_release_ramdump_mem(sc->ol_sc->ramdump_base); hif_deinit_adf_ctx(ol_sc); err_attach1: A_FREE(ol_sc); diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c index 48a3762874ee..119194fc98b5 100644 --- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c @@ -1784,7 +1784,12 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe #endif ret = hifEnableFunc(device, func); - return (ret == A_OK || ret == A_PENDING) ? 0 : -1; + if (ret == A_OK || ret == A_PENDING) { + return 0; + } else { + delHifDevice(device); + return -1; + } } @@ -2088,9 +2093,17 @@ static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func) ret = osdrvCallbacks.deviceInsertedHandler( osdrvCallbacks.context,device); /* start up inform DRV layer */ - if (ret != A_OK) + if (ret != A_OK) { AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6k: Device rejected error:%d \n", ret)); + /* + * Disable the SDIO func & Reset the sdio + * for automated tests to move ahead, where + * the card does not need to be removed at + * the end of the test. + */ + hifDisableFunc(device, func); + } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) } else { AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, -- cgit v1.2.3