qcacmn: Avoid un-initialized pointer access

Avoid un-initialized pointer access by initializing pointer to NULL
or valid value that is address of another variable.

Change-Id: I0666e7cebf9f39928b6b095fa4f7f017b5b2a837
CRs-Fixed: 2219381
This commit is contained in:
Naveen Rawat
2018-04-05 14:12:08 -07:00
committed by nshrivas
parent f2d4e23818
commit 1c4d57ea15
2 changed files with 15 additions and 9 deletions

View File

@@ -65,6 +65,12 @@ target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
cp_stats_tx_ops = &tx_ops->cp_stats_tx_ops;
if (!cp_stats_tx_ops) {
cp_stats_err("lmac tx ops is NULL!");
return QDF_STATUS_E_FAILURE;
}
cp_stats_tx_ops->cp_stats_attach = cp_stats_tx_ops->cp_stats_attach =
target_if_cp_stats_register_event_handler; target_if_cp_stats_register_event_handler;
cp_stats_tx_ops->cp_stats_detach = cp_stats_tx_ops->cp_stats_detach =

View File

@@ -33,10 +33,10 @@
QDF_STATUS QDF_STATUS
wlan_cp_stats_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) wlan_cp_stats_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg)
{ {
QDF_STATUS status = QDF_STATUS_E_FAILURE;
WLAN_DEV_TYPE dev_type; WLAN_DEV_TYPE dev_type;
struct psoc_cp_stats *psoc_cs; struct cp_stats_context *csc = NULL;
struct cp_stats_context *csc; struct psoc_cp_stats *psoc_cs = NULL;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
if (!psoc) { if (!psoc) {
cp_stats_err("PSOC is NULL"); cp_stats_err("PSOC is NULL");
@@ -144,9 +144,9 @@ wlan_cp_stats_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc, void *arg)
QDF_STATUS QDF_STATUS
wlan_cp_stats_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg) wlan_cp_stats_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg)
{ {
struct cp_stats_context *csc = NULL;
struct pdev_cp_stats *pdev_cs = NULL;
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct pdev_cp_stats *pdev_cs;
struct cp_stats_context *csc;
if (!pdev) { if (!pdev) {
cp_stats_err("PDEV is NULL"); cp_stats_err("PDEV is NULL");
@@ -231,9 +231,9 @@ wlan_cp_stats_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, void *arg)
QDF_STATUS QDF_STATUS
wlan_cp_stats_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, void *arg) wlan_cp_stats_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, void *arg)
{ {
struct cp_stats_context *csc = NULL;
struct vdev_cp_stats *vdev_cs = NULL;
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct vdev_cp_stats *vdev_cs;
struct cp_stats_context *csc;
if (!vdev) { if (!vdev) {
cp_stats_err("vdev is NULL"); cp_stats_err("vdev is NULL");
@@ -318,9 +318,9 @@ wlan_cp_stats_vdev_obj_destroy_handler(struct wlan_objmgr_vdev *vdev, void *arg)
QDF_STATUS QDF_STATUS
wlan_cp_stats_peer_obj_create_handler(struct wlan_objmgr_peer *peer, void *arg) wlan_cp_stats_peer_obj_create_handler(struct wlan_objmgr_peer *peer, void *arg)
{ {
struct cp_stats_context *csc = NULL;
struct peer_cp_stats *peer_cs = NULL;
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status = QDF_STATUS_E_FAILURE;
struct peer_cp_stats *peer_cs;
struct cp_stats_context *csc;
if (!peer) { if (!peer) {
cp_stats_err("peer is NULL"); cp_stats_err("peer is NULL");