summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuanyuan Liu <yuanliu@codeaurora.org>2016-07-06 17:20:01 -0700
committerNandini Suresh <snandini@codeaurora.org>2016-07-06 22:44:40 -0700
commit805280600866aae1ee96798bbcbbbf3ca0baa04b (patch)
tree6cec07707d05fa8bb0d0962b96abdd083c46af59
parentdc7f2c9c2fa37f500b951cb561632e8d9e90ebb9 (diff)
qcacld-3.0: Add NULL check for ol_ctx in bmi_download_firmware
ol_ctx is NULL by default if NO_BMI is defined. Hence, add NULL check for ol_ctx in bmi_download_firmware so that this NULL pointer could be handled properly in BMI and NO_BMI cases. Change-Id: I17b6a7e266e41b1f9135bb81bf4329c1ae460862 CRs-Fixed: 1038414
-rw-r--r--core/bmi/src/bmi.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/bmi/src/bmi.c b/core/bmi/src/bmi.c
index 0ce5007bbbd8..de021a760ae8 100644
--- a/core/bmi/src/bmi.c
+++ b/core/bmi/src/bmi.c
@@ -216,7 +216,20 @@ bmi_get_target_info(struct bmi_target_info *targ_info,
QDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx)
{
- struct hif_opaque_softc *scn = ol_ctx->scn;
+ struct hif_opaque_softc *scn;
+
+ if (!ol_ctx) {
+ if (NO_BMI) {
+ /* ol_ctx is not allocated in NO_BMI case */
+ return QDF_STATUS_SUCCESS;
+ } else {
+ BMI_ERR("ol_ctx is NULL");
+ bmi_assert(0);
+ return QDF_STATUS_NOT_INITIALIZED;
+ }
+ }
+
+ scn = ol_ctx->scn;
if (!scn) {
BMI_ERR("Invalid scn context");
@@ -224,7 +237,7 @@ QDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx)
return QDF_STATUS_NOT_INITIALIZED;
}
- if (NO_BMI || !hif_needs_bmi(scn))
+ if (!hif_needs_bmi(scn))
return QDF_STATUS_SUCCESS;
return bmi_firmware_download(ol_ctx);