summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Khanna <mkhannaqca@codeaurora.org>2016-11-30 18:39:07 -0800
committerqcabuildsw <qcabuildsw@localhost>2016-12-06 23:20:32 -0800
commit420d0df5e01dcb1a333a0daeb701f61d00a81884 (patch)
treef98b3fee06b90093863a54dd1ffb3a2ae846c171
parentb2fdd7302ed35b44f5c1ef47864c35c0538347e1 (diff)
qcacld-3.0: NULL check return-value from cds_get_context
Add null check while accessing pdev and hif pointers from cds_get_context API in OL layer. CRs-Fixed: 1096535 Change-Id: I2e3e7e04f1dcc9248fe173b7cdfc8d8704d0d1d9
-rw-r--r--core/dp/txrx/ol_txrx.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c
index eb66eab1dd14..4aa51031b6d7 100644
--- a/core/dp/txrx/ol_txrx.c
+++ b/core/dp/txrx/ol_txrx.c
@@ -4816,6 +4816,13 @@ void ol_register_lro_flush_cb(void (lro_flush_cb)(void *),
hif_device = (struct hif_opaque_softc *)
cds_get_context(QDF_MODULE_ID_HIF);
+ if (qdf_unlikely(hif_device == NULL)) {
+ TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+ "%s: hif_device NULL!", __func__);
+ qdf_assert(0);
+ goto out;
+ }
+
hif_lro_flush_cb_register(hif_device, ol_txrx_lro_flush, lro_init_cb);
qdf_atomic_inc(&pdev->lro_info.lro_dev_cnt);
@@ -4849,6 +4856,13 @@ void ol_deregister_lro_flush_cb(void (lro_deinit_cb)(void *))
hif_device =
(struct hif_opaque_softc *)cds_get_context(QDF_MODULE_ID_HIF);
+ if (qdf_unlikely(hif_device == NULL)) {
+ TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+ "%s: hif_device NULL!", __func__);
+ qdf_assert(0);
+ return;
+ }
+
hif_lro_flush_cb_deregister(hif_device, lro_deinit_cb);
pdev->lro_info.lro_flush_cb = NULL;