From b73fc282d84e9ed79cd2865ef05296876a6c8ba8 Mon Sep 17 00:00:00 2001 From: Madhvapathi Sriram Date: Mon, 7 Jan 2019 09:12:25 +0530 Subject: [PATCH] qcacmn: Remove error log for qdf_mem_malloc in umac files qdf layer already has the error trace Change-Id: I2ea22fe0e3e59b9d41ac21142615ffb96227abaf CRs-Fixed: 2376418 --- .../crypto/src/wlan_crypto_global_api.c | 24 +++++++----------- .../mgmt_txrx/core/src/wlan_mgmt_txrx_main.c | 7 +++--- .../dispatcher/src/wlan_mgmt_txrx_utils_api.c | 10 ++------ .../obj_mgr/src/wlan_objmgr_debug.c | 8 +++--- .../obj_mgr/src/wlan_objmgr_global_obj.c | 7 +++--- .../obj_mgr/src/wlan_objmgr_pdev_obj.c | 7 +++--- .../obj_mgr/src/wlan_objmgr_peer_obj.c | 10 +++----- .../obj_mgr/src/wlan_objmgr_psoc_obj.c | 12 +++------ .../obj_mgr/src/wlan_objmgr_vdev_obj.c | 5 ++-- .../src/wlan_serialization_main.c | 16 +++--------- .../sm_engine/src/wlan_sm_engine.c | 4 +-- .../core/src/wlan_cp_stats_obj_mgr_handler.c | 7 +----- .../dispatcher/src/wlan_cp_stats_mc_tgt_api.c | 8 ++---- .../src/wlan_cp_stats_mc_ucfg_api.c | 21 ++++++---------- umac/dfs/core/src/filtering/dfs_init.c | 7 ++---- .../src/filtering/dfs_process_radarevent.c | 5 +--- umac/dfs/core/src/misc/dfs.c | 7 +----- umac/dfs/core/src/misc/dfs_filter_init.c | 25 ++++++------------- umac/dfs/core/src/misc/dfs_nol.c | 16 ++++++------ umac/dfs/core/src/misc/dfs_random_chan_sel.c | 9 ++----- .../dispatcher/src/wlan_dfs_init_deinit_api.c | 5 +--- umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 17 +++---------- .../dispatcher/src/wlan_green_ap_api.c | 6 ++--- .../dispatcher/src/wlan_vdev_mlme_main.c | 4 +-- .../scan/dispatcher/src/wlan_scan_utils_api.c | 10 +++----- umac/wifi_pos/src/wifi_pos_main.c | 8 ++---- 26 files changed, 81 insertions(+), 184 deletions(-) diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index 5833f836577a..8fbd62d2dcd8 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -619,10 +619,8 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_E_INVAL; } key = qdf_mem_malloc(sizeof(struct wlan_crypto_key)); - if (key == NULL) { - crypto_err("igtk key alloc failed"); + if (!key) return QDF_STATUS_E_NOMEM; - } if (crypto_priv->igtk_key[igtk_idx]) qdf_mem_free(crypto_priv->igtk_key[igtk_idx]); @@ -702,10 +700,9 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_E_INVAL; } key = qdf_mem_malloc(sizeof(struct wlan_crypto_key)); - if (key == NULL) { - crypto_err("igtk key alloc failed"); + if (!key) return QDF_STATUS_E_NOMEM; - } + if (crypto_priv->igtk_key[igtk_idx]) qdf_mem_free(crypto_priv->igtk_key[igtk_idx]); @@ -1783,10 +1780,9 @@ uint8_t *wlan_crypto_add_mmie(struct wlan_objmgr_vdev *vdev, hdr = (struct wlan_frame_hdr *) bfrm; buf = qdf_mem_malloc(len - hdrlen + 20); - if (!buf) { - crypto_err("malloc failed"); + if (!buf) return NULL; - } + qdf_mem_zero(buf, len - hdrlen + 20); aad = buf; /* generate BIP AAD: FC(masked) || A1 || A2 || A3 */ @@ -1921,10 +1917,9 @@ bool wlan_crypto_is_mmie_valid(struct wlan_objmgr_vdev *vdev, } buf = qdf_mem_malloc(len - hdrlen + 20); - if (!buf) { - crypto_err("malloc failed"); + if (!buf) return false; - } + aad = buf; /* construct AAD */ @@ -3142,10 +3137,9 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev, if (cipher_table->cipher == WLAN_CRYPTO_CIPHER_WEP) { sta_key = qdf_mem_malloc( sizeof(struct wlan_crypto_key)); - if (!sta_key) { - crypto_err("key alloc failed"); + if (!sta_key) return QDF_STATUS_E_NOMEM; - } + sta_crypto_priv->key[i] = sta_key; qdf_mem_copy(sta_key, key, sizeof(struct wlan_crypto_key)); diff --git a/umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c b/umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c index d68763bc0fd0..5fcff44f83ee 100644 --- a/umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c +++ b/umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -38,10 +38,9 @@ QDF_STATUS wlan_mgmt_txrx_desc_pool_init( MGMT_DESC_POOL_MAX * sizeof(struct mgmt_txrx_desc_elem_t)); - if (!mgmt_txrx_pdev_ctx->mgmt_desc_pool.pool) { - mgmt_txrx_err("Failed to allocate desc pool"); + if (!mgmt_txrx_pdev_ctx->mgmt_desc_pool.pool) return QDF_STATUS_E_NOMEM; - } + qdf_list_create(&mgmt_txrx_pdev_ctx->mgmt_desc_pool.free_list, MGMT_DESC_POOL_MAX); diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c index 683239bce27b..4bc6836486c9 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c +++ b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -58,7 +58,6 @@ static QDF_STATUS wlan_mgmt_txrx_psoc_obj_create_notification( mgmt_txrx_psoc_ctx = qdf_mem_malloc(sizeof(*mgmt_txrx_psoc_ctx)); if (!mgmt_txrx_psoc_ctx) { - mgmt_txrx_err("Failed to allocate mgmt txrx context"); status = QDF_STATUS_E_NOMEM; goto err_return; } @@ -162,7 +161,6 @@ static QDF_STATUS wlan_mgmt_txrx_pdev_obj_create_notification( mgmt_txrx_pdev_ctx = qdf_mem_malloc(sizeof(*mgmt_txrx_pdev_ctx)); if (!mgmt_txrx_pdev_ctx) { - mgmt_txrx_err("Failed to allocate mgmt txrx context"); status = QDF_STATUS_E_NOMEM; goto err_return; } @@ -179,8 +177,6 @@ static QDF_STATUS wlan_mgmt_txrx_pdev_obj_create_notification( mgmt_txrx_stats = qdf_mem_malloc(sizeof(*mgmt_txrx_stats)); if (!mgmt_txrx_stats) { - mgmt_txrx_err( - "Failed to allocate memory for mgmt txrx stats structure"); status = QDF_STATUS_E_NOMEM; goto err_mgmt_txrx_stats; } @@ -535,10 +531,8 @@ static QDF_STATUS wlan_mgmt_txrx_create_rx_handler( struct mgmt_rx_handler *rx_handler; rx_handler = qdf_mem_malloc(sizeof(*rx_handler)); - if (!rx_handler) { - mgmt_txrx_err("Couldn't allocate memory for rx handler"); + if (!rx_handler) return QDF_STATUS_E_NOMEM; - } rx_handler->comp_id = comp_id; rx_handler->rx_cb = mgmt_rx_cb; diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_debug.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_debug.c index c9aa2b7cb166..cc43f0424dd7 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_debug.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_debug.c @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -154,10 +154,9 @@ void wlan_objmgr_notify_log_delete(void *obj, tstamp = qdf_system_ticks_to_msecs(qdf_system_ticks()) / 1000; node = qdf_mem_malloc(sizeof(*node)); - if (!node) { - obj_mgr_err("Object node creation failed"); + if (!node) return; - } + node->obj = obj; node->obj_type = obj_type; node->tstamp = tstamp; @@ -363,7 +362,6 @@ void wlan_objmgr_debug_info_init(void) debug_info = qdf_mem_malloc(sizeof(*debug_info)); if (!debug_info) { - obj_mgr_err("debug_info allocation failed"); g_umac_glb_obj->debug_info = NULL; return; } diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c index 065cb19114ce..6fea3c09992b 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -44,10 +44,9 @@ QDF_STATUS wlan_objmgr_global_obj_init(void) /* Allocation of memory for Global object */ umac_global_obj = (struct wlan_objmgr_global *)qdf_mem_malloc( sizeof(*umac_global_obj)); - if (umac_global_obj == NULL) { - obj_mgr_err("Global object alloc failed due to malloc"); + if (!umac_global_obj) return QDF_STATUS_E_NOMEM; - } + /* Store Global object pointer in Global variable */ g_umac_glb_obj = umac_global_obj; /* Initialize spinlock */ diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c index 8884b38d5481..53bf3a1f4287 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -107,10 +107,9 @@ struct wlan_objmgr_pdev *wlan_objmgr_pdev_obj_create( } /* Allocate PDEV object's memory */ pdev = qdf_mem_malloc(sizeof(*pdev)); - if (pdev == NULL) { - obj_mgr_err("pdev alloc failed"); + if (!pdev) return NULL; - } + pdev->obj_state = WLAN_OBJ_STATE_ALLOCATED; /* Initialize PDEV spinlock */ qdf_spinlock_create(&pdev->pdev_lock); diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c index 49d8daebe3d3..d29133781d94 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -177,13 +177,9 @@ struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create( } /* Allocate memory for peer object */ peer = qdf_mem_malloc(sizeof(*peer)); - if (peer == NULL) { - obj_mgr_err( - "Peer(%02x:%02x:%02x:%02x:%02x:%02x) allocation failure", - macaddr[0], macaddr[1], macaddr[2], - macaddr[3], macaddr[4], macaddr[5]); + if (!peer) return NULL; - } + peer->obj_state = WLAN_OBJ_STATE_ALLOCATED; qdf_atomic_init(&peer->peer_objmgr.ref_cnt); wlan_objmgr_peer_init_ref_id_debug(peer); diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c index 44344af85dc3..15067eaaf43e 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -119,10 +119,9 @@ struct wlan_objmgr_psoc *wlan_objmgr_psoc_obj_create(uint32_t phy_version, void *arg; psoc = qdf_mem_malloc(sizeof(*psoc)); - if (psoc == NULL) { - obj_mgr_err("PSOC allocation failed"); + if (!psoc) return NULL; - } + psoc->obj_state = WLAN_OBJ_STATE_ALLOCATED; qdf_spinlock_create(&psoc->psoc_lock); /* Initialize with default values */ @@ -1297,10 +1296,8 @@ static qdf_list_t bool lock_released = false; logical_del_peer_list = qdf_mem_malloc(sizeof(*logical_del_peer_list)); - if (!logical_del_peer_list) { - obj_mgr_err("failed to allocate list"); + if (!logical_del_peer_list) return NULL; - } qdf_list_create(logical_del_peer_list, WLAN_UMAC_PSOC_MAX_PEERS); @@ -1337,7 +1334,6 @@ static qdf_list_t if (peer_list == NULL) { wlan_objmgr_peer_release_ref(peer, dbg_id); /* Lock is already released */ - obj_mgr_alert("Mem alloc failed"); WLAN_OBJMGR_BUG(0); break; } diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c index 63d32000b50f..3ba3a93e3888 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c @@ -138,10 +138,9 @@ struct wlan_objmgr_vdev *wlan_objmgr_vdev_obj_create( } /* Allocate vdev object memory */ vdev = qdf_mem_malloc(sizeof(*vdev)); - if (vdev == NULL) { - obj_mgr_err("Memory allocation failure"); + if (!vdev) return NULL; - } + vdev->obj_state = WLAN_OBJ_STATE_ALLOCATED; vdev->vdev_mlme.bss_chan = qdf_mem_malloc(sizeof(struct wlan_channel)); diff --git a/umac/cmn_services/serialization/src/wlan_serialization_main.c b/umac/cmn_services/serialization/src/wlan_serialization_main.c index 36f6b07eb723..dbb7fb33355c 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_main.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_main.c @@ -22,7 +22,6 @@ * serialization to initialize and de-initialize the * component. */ - #include #include #include @@ -78,7 +77,6 @@ QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc) qdf_mem_malloc(sizeof(struct wlan_serialization_timer) * ser_soc_obj->max_active_cmds); if (!ser_soc_obj->timers) { - ser_alert("Mem alloc failed for ser timers"); status = QDF_STATUS_E_NOMEM; goto error; } @@ -110,10 +108,9 @@ static QDF_STATUS wlan_serialization_psoc_create_handler( soc_ser_obj = qdf_mem_malloc(sizeof(*soc_ser_obj)); - if (!soc_ser_obj) { - ser_alert("Mem alloc failed for ser psoc priv obj"); + if (!soc_ser_obj) goto error; - } + status = wlan_objmgr_psoc_component_obj_attach( psoc, WLAN_UMAC_COMP_SERIALIZATION, @@ -185,7 +182,6 @@ wlan_serialization_create_cmd_pool( for (i = 0; i < cmd_pool_size; i++) { cmd_list_ptr = qdf_mem_malloc(sizeof(*cmd_list_ptr)); if (!cmd_list_ptr) { - ser_alert("Mem alloc failed for cmd node"); wlan_serialization_destroy_cmd_pool(pdev_queue); goto error; } @@ -231,10 +227,8 @@ static QDF_STATUS wlan_serialization_pdev_create_handler( ser_pdev_obj = qdf_mem_malloc(sizeof(*ser_pdev_obj)); - if (!ser_pdev_obj) { - ser_alert("Mem alloc failed for ser pdev obj"); + if (!ser_pdev_obj) goto error; - } for (index = 0; index < SER_PDEV_QUEUE_COMP_MAX; index++) { pdev_queue = &ser_pdev_obj->pdev_q[index]; @@ -396,10 +390,8 @@ wlan_serialization_vdev_create_handler(struct wlan_objmgr_vdev *vdev, uint8_t max_pending_cmds; ser_vdev_obj = qdf_mem_malloc(sizeof(*ser_vdev_obj)); - if (!ser_vdev_obj) { - ser_alert("Mem alloc failed for ser vdev obj"); + if (!ser_vdev_obj) goto error; - } for (index = 0; index < SER_VDEV_QUEUE_COMP_MAX; index++) { vdev_q = &ser_vdev_obj->vdev_q[index]; diff --git a/umac/cmn_services/sm_engine/src/wlan_sm_engine.c b/umac/cmn_services/sm_engine/src/wlan_sm_engine.c index 26e22f1e081d..6b6e6fb37045 100644 --- a/umac/cmn_services/sm_engine/src/wlan_sm_engine.c +++ b/umac/cmn_services/sm_engine/src/wlan_sm_engine.c @@ -257,10 +257,8 @@ struct wlan_sm *wlan_sm_create(const char *name, void *ctx, } sm = qdf_mem_malloc(sizeof(*sm)); - if (!sm) { - sm_engine_alert("%s: sm allocation failed", name); + if (!sm) return NULL; - } wlan_sm_history_init(sm); diff --git a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c index 11f94608b67c..50e442f26efb 100644 --- a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c +++ b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -46,7 +46,6 @@ wlan_cp_stats_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) csc = qdf_mem_malloc(sizeof(*csc)); if (!csc) { - cp_stats_err("Failed to allocate cp_stats_context object"); status = QDF_STATUS_E_NOMEM; goto wlan_cp_stats_psoc_obj_create_handler_return; } @@ -72,7 +71,6 @@ wlan_cp_stats_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) psoc_cs = qdf_mem_malloc(sizeof(*psoc_cs)); if (!psoc_cs) { - cp_stats_err("Failed to allocate psoc_cp_stats object"); status = QDF_STATUS_E_NOMEM; goto wlan_cp_stats_psoc_obj_create_handler_return; } @@ -160,7 +158,6 @@ wlan_cp_stats_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg) pdev_cs = qdf_mem_malloc(sizeof(*pdev_cs)); if (!pdev_cs) { - cp_stats_err("Failed to allocate pdev_cp_stats object"); status = QDF_STATUS_E_NOMEM; goto wlan_cp_stats_pdev_obj_create_handler_return; } @@ -248,7 +245,6 @@ wlan_cp_stats_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, void *arg) vdev_cs = qdf_mem_malloc(sizeof(*vdev_cs)); if (!vdev_cs) { - cp_stats_err("Failed to allocate vdev_cp_stats object"); status = QDF_STATUS_E_NOMEM; goto wlan_cp_stats_vdev_obj_create_handler_return; } @@ -336,7 +332,6 @@ wlan_cp_stats_peer_obj_create_handler(struct wlan_objmgr_peer *peer, void *arg) peer_cs = qdf_mem_malloc(sizeof(*peer_cs)); if (!peer_cs) { - cp_stats_err("Failed to allocate peer_cp_stats object"); status = QDF_STATUS_E_NOMEM; goto wlan_cp_stats_peer_obj_create_handler_return; } diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index 8ab809a404e2..51984248b1c7 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c @@ -169,10 +169,8 @@ tgt_mc_cp_stats_prepare_raw_peer_rssi(struct wlan_objmgr_psoc *psoc, peer_count = wlan_pdev_get_peer_count(pdev); ev.peer_stats = qdf_mem_malloc(sizeof(*ev.peer_stats) * peer_count); - if (!ev.peer_stats) { - cp_stats_err("malloc failed"); + if (!ev.peer_stats) goto end; - } wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_PEER_OP, peer_rssi_iterator, &ev, @@ -192,10 +190,8 @@ tgt_mc_cp_stats_prepare_raw_peer_rssi(struct wlan_objmgr_psoc *psoc, } ev.peer_stats = qdf_mem_malloc(sizeof(*ev.peer_stats)); - if (!ev.peer_stats) { - cp_stats_err("malloc failed"); + if (!ev.peer_stats) goto end; - } ev.num_peer_stats = 1; wlan_cp_stats_peer_obj_lock(peer_cp_stats_priv); diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c index daad59001325..7a777047d36e 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -34,10 +34,8 @@ QDF_STATUS wlan_cp_stats_psoc_cs_init(struct psoc_cp_stats *psoc_cs) { psoc_cs->obj_stats = qdf_mem_malloc(sizeof(struct psoc_mc_cp_stats)); - if (!psoc_cs->obj_stats) { - cp_stats_err("malloc failed"); + if (!psoc_cs->obj_stats) return QDF_STATUS_E_NOMEM; - } return QDF_STATUS_SUCCESS; } @@ -52,10 +50,9 @@ QDF_STATUS wlan_cp_stats_psoc_cs_deinit(struct psoc_cp_stats *psoc_cs) QDF_STATUS wlan_cp_stats_vdev_cs_init(struct vdev_cp_stats *vdev_cs) { vdev_cs->vdev_stats = qdf_mem_malloc(sizeof(struct vdev_mc_cp_stats)); - if (!vdev_cs->vdev_stats) { - cp_stats_err("malloc failed"); + if (!vdev_cs->vdev_stats) return QDF_STATUS_E_NOMEM; - } + return QDF_STATUS_SUCCESS; } @@ -69,10 +66,9 @@ QDF_STATUS wlan_cp_stats_vdev_cs_deinit(struct vdev_cp_stats *vdev_cs) QDF_STATUS wlan_cp_stats_pdev_cs_init(struct pdev_cp_stats *pdev_cs) { pdev_cs->pdev_stats = qdf_mem_malloc(sizeof(struct pdev_mc_cp_stats)); - if (!pdev_cs->pdev_stats) { - cp_stats_err("malloc failed"); + if (!pdev_cs->pdev_stats) return QDF_STATUS_E_NOMEM; - } + return QDF_STATUS_SUCCESS; } @@ -86,10 +82,9 @@ QDF_STATUS wlan_cp_stats_pdev_cs_deinit(struct pdev_cp_stats *pdev_cs) QDF_STATUS wlan_cp_stats_peer_cs_init(struct peer_cp_stats *peer_cs) { peer_cs->peer_stats = qdf_mem_malloc(sizeof(struct peer_mc_cp_stats)); - if (!peer_cs->peer_stats) { - cp_stats_err("malloc failed"); + if (!peer_cs->peer_stats) return QDF_STATUS_E_NOMEM; - } + return QDF_STATUS_SUCCESS; } diff --git a/umac/dfs/core/src/filtering/dfs_init.c b/umac/dfs/core/src/filtering/dfs_init.c index 1f443805a918..3f90261e4bcf 100644 --- a/umac/dfs/core/src/filtering/dfs_init.c +++ b/umac/dfs/core/src/filtering/dfs_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2013, 2016-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2002-2010, Atheros Communications Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -355,11 +355,8 @@ int dfs_init_radar_filters(struct wlan_dfs *dfs, * Malloc can return NULL if numb5radars is zero. But we still * want to reset the delay lines. */ - if (!(dfs->dfs_b5radars)) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "cannot allocate memory for bin5 radars"); + if (!(dfs->dfs_b5radars)) goto bad4; - } } for (n = 0; n < numb5radars; n++) { diff --git a/umac/dfs/core/src/filtering/dfs_process_radarevent.c b/umac/dfs/core/src/filtering/dfs_process_radarevent.c index fb2bfb323c1b..80ad26533546 100644 --- a/umac/dfs/core/src/filtering/dfs_process_radarevent.c +++ b/umac/dfs/core/src/filtering/dfs_process_radarevent.c @@ -1291,11 +1291,8 @@ void dfs_radarfound_action_generic(struct wlan_dfs *dfs, uint8_t seg_id) struct radar_found_info *radar_found; radar_found = qdf_mem_malloc(sizeof(*radar_found)); - if (!radar_found) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "radar_found allocation failed"); + if (!radar_found) return; - } qdf_mem_zero(radar_found, sizeof(*radar_found)); radar_found->segment_id = seg_id; diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index 62b6e902bfcd..24094d9679dd 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -151,19 +151,14 @@ void dfs_main_task_testtimer_init(struct wlan_dfs *dfs) int dfs_create_object(struct wlan_dfs **dfs) { *dfs = dfs_alloc_wlan_dfs(); - if (!(*dfs)) { - dfs_alert(NULL, WLAN_DEBUG_DFS_ALWAYS, - "wlan_dfs allocation failed"); + if (!(*dfs)) return 1; - } qdf_mem_zero(*dfs, sizeof(**dfs)); (*dfs)->dfs_curchan = dfs_alloc_dfs_curchan(); if (!((*dfs)->dfs_curchan)) { dfs_free_wlan_dfs(*dfs); - dfs_alert(*dfs, WLAN_DEBUG_DFS_ALWAYS, - "dfs_curchan allocation failed"); return 1; } diff --git a/umac/dfs/core/src/misc/dfs_filter_init.c b/umac/dfs/core/src/misc/dfs_filter_init.c index 33b579d1496c..58c401adc9cf 100644 --- a/umac/dfs/core/src/misc/dfs_filter_init.c +++ b/umac/dfs/core/src/misc/dfs_filter_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2002-2006, Atheros Communications Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -229,11 +229,8 @@ int dfs_main_attach(struct wlan_dfs *dfs) WLAN_DFS_DATA_STRUCT_LOCK_CREATE(dfs); dfs->events = dfs_alloc_dfs_events(); - if (!(dfs->events)) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "events allocation failed"); + if (!(dfs->events)) return 1; - } for (i = 0; i < DFS_MAX_EVENTS; i++) STAILQ_INSERT_TAIL(&(dfs->dfs_eventq), &dfs->events[i], @@ -243,8 +240,6 @@ int dfs_main_attach(struct wlan_dfs *dfs) if (!(dfs->pulses)) { dfs_free_dfs_events(dfs->events); dfs->events = NULL; - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "Pulse buffer allocation failed"); return 1; } @@ -254,11 +249,9 @@ int dfs_main_attach(struct wlan_dfs *dfs) for (n = 0; n < DFS_MAX_RADAR_TYPES; n++) { dfs->dfs_radarf[n] = (struct dfs_filtertype *) qdf_mem_malloc(sizeof(struct dfs_filtertype)); - if (!(dfs->dfs_radarf[n])) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "cannot allocate memory for radar filter types"); + if (!(dfs->dfs_radarf[n])) goto bad1; - } + qdf_mem_zero(dfs->dfs_radarf[n], sizeof(struct dfs_filtertype)); status = dfs_alloc_mem_filter(dfs->dfs_radarf[n]); @@ -272,18 +265,14 @@ int dfs_main_attach(struct wlan_dfs *dfs) /* Allocate memory for radar table. */ dfs->dfs_ftindextable = (int8_t **)qdf_mem_malloc( DFS_NUM_FT_IDX_TBL_ROWS*sizeof(int8_t *)); - if (!(dfs->dfs_ftindextable)) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "Cannot allocate memory for radar table"); + if (!(dfs->dfs_ftindextable)) goto bad1; - } + for (n = 0; n < DFS_NUM_FT_IDX_TBL_ROWS; n++) { dfs->dfs_ftindextable[n] = qdf_mem_malloc( DFS_MAX_RADAR_OVERLAP*sizeof(int8_t)); - if (!(dfs->dfs_ftindextable[n])) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "cannot allocate memory for radar table entry"); + if (!(dfs->dfs_ftindextable[n])) goto bad2; - } } dfs->dfs_use_nol = 1; diff --git a/umac/dfs/core/src/misc/dfs_nol.c b/umac/dfs/core/src/misc/dfs_nol.c index 92bc2439b121..c0d432cca4fc 100644 --- a/umac/dfs/core/src/misc/dfs_nol.c +++ b/umac/dfs/core/src/misc/dfs_nol.c @@ -487,16 +487,14 @@ void dfs_nol_update(struct wlan_dfs *dfs) dfs_nol = (struct dfsreq_nolelem *)qdf_mem_malloc( sizeof(struct dfsreq_nolelem) * dfs->dfs_nol_count); - if (!dfs_nol) { - /* - * XXX TODO: if this fails, just schedule a task to retry - * updating the NOL at a later stage. That way the NOL - * update _DOES_ happen - hopefully the failure was just - * temporary. - */ - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "failed to allocate NOL update memory!"); + /* + * XXX TODO: if this fails, just schedule a task to retry + * updating the NOL at a later stage. That way the NOL + * update _DOES_ happen - hopefully the failure was just + * temporary. + */ + if (!dfs_nol) return; - } DFS_GET_NOL_LOCKED(dfs, dfs_nol, &nlen); diff --git a/umac/dfs/core/src/misc/dfs_random_chan_sel.c b/umac/dfs/core/src/misc/dfs_random_chan_sel.c index 9eb6b5680a30..cf095a0a7021 100644 --- a/umac/dfs/core/src/misc/dfs_random_chan_sel.c +++ b/umac/dfs/core/src/misc/dfs_random_chan_sel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1403,11 +1403,8 @@ uint8_t dfs_prepare_random_channel(struct wlan_dfs *dfs, } random_chan_list = qdf_mem_malloc(ch_cnt * sizeof(*random_chan_list)); - if (!random_chan_list) { - dfs_alert(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, - "Memory allocation failed"); + if (!random_chan_list) return 0; - } if (flags & DFS_RANDOM_CH_FLAG_NO_CURR_OPE_CH) dfs_remove_cur_ch_from_list(ch_list, &ch_cnt, ch_wd, cur_chan); @@ -1421,8 +1418,6 @@ uint8_t dfs_prepare_random_channel(struct wlan_dfs *dfs, /* list adjusted after leakage has been marked */ leakage_adjusted_lst = qdf_mem_malloc(random_chan_cnt); if (!leakage_adjusted_lst) { - dfs_alert(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, - "Memory allocation failed"); qdf_mem_free(random_chan_list); return 0; } diff --git a/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c b/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c index dd6ec4f9498e..07a055b59b77 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c @@ -141,11 +141,8 @@ static QDF_STATUS dfs_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc struct dfs_soc_priv_obj *dfs_soc_obj; dfs_soc_obj = qdf_mem_malloc(sizeof(*dfs_soc_obj)); - if (!dfs_soc_obj) { - dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, - "Failed to allocate memory for dfs object"); + if (!dfs_soc_obj) return QDF_STATUS_E_NOMEM; - } dfs_soc_obj->psoc = psoc; diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index 023dae89eafd..5f4aaa5b4065 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -609,7 +609,6 @@ void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev, cur_chan_list = qdf_mem_malloc(NUM_CHANNELS * sizeof(struct regulatory_channel)); if (!cur_chan_list) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "fail to alloc"); *num_chan = 0; return; } @@ -677,10 +676,8 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev, } tmp_chan_list = qdf_mem_malloc(*num_chan * sizeof(*tmp_chan_list)); - if (!tmp_chan_list) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "mem alloc failed"); + if (!tmp_chan_list) return; - } utils_dfs_get_chan_list(pdev, (void *)tmp_chan_list, num_chan); @@ -815,10 +812,8 @@ QDF_STATUS utils_dfs_get_random_channel( wlan_reg_get_dfs_region(pdev, &dfs_reg); chan_list = qdf_mem_malloc(num_chan * sizeof(*chan_list)); - if (!chan_list) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "mem alloc failed"); + if (!chan_list) goto random_chan_error; - } utils_dfs_get_channel_list(pdev, chan_list, &num_chan); if (!num_chan) { @@ -933,10 +928,8 @@ void utils_dfs_init_nol(struct wlan_objmgr_pdev *pdev) } dfs_nolinfo = qdf_mem_malloc(sizeof(*dfs_nolinfo)); - if (!dfs_nolinfo) { - dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs_nolinfo alloc fail"); + if (!dfs_nolinfo) return; - } qdf_mem_zero(dfs_nolinfo, sizeof(*dfs_nolinfo)); len = pld_wlan_get_dfs_nol(qdf_dev->dev, (void *)dfs_nolinfo, @@ -985,10 +978,8 @@ void utils_dfs_save_nol(struct wlan_objmgr_pdev *pdev) } dfs_nolinfo = qdf_mem_malloc(sizeof(*dfs_nolinfo)); - if (!dfs_nolinfo) { - dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs_nolinfo alloc fail"); + if (!dfs_nolinfo) return; - } qdf_mem_zero(dfs_nolinfo, sizeof(*dfs_nolinfo)); DFS_GET_NOL_LOCKED(dfs, dfs_nolinfo->dfs_nol, &num_chans); diff --git a/umac/green_ap/dispatcher/src/wlan_green_ap_api.c b/umac/green_ap/dispatcher/src/wlan_green_ap_api.c index 8bf62557883f..e8cb23645d60 100644 --- a/umac/green_ap/dispatcher/src/wlan_green_ap_api.c +++ b/umac/green_ap/dispatcher/src/wlan_green_ap_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -75,10 +75,8 @@ static QDF_STATUS wlan_green_ap_pdev_obj_create_notification( } green_ap_ctx = qdf_mem_malloc(sizeof(*green_ap_ctx)); - if (!green_ap_ctx) { - green_ap_err("Memory allocation for Green AP context failed!"); + if (!green_ap_ctx) return QDF_STATUS_E_NOMEM; - } green_ap_ctx->ps_state = WLAN_GREEN_AP_PS_IDLE_STATE; green_ap_ctx->ps_event = WLAN_GREEN_AP_PS_WAIT_EVENT; diff --git a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c index 4857f1523acf..06a4e7070a9b 100644 --- a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c +++ b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c @@ -56,10 +56,8 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, } vdev_mlme = qdf_mem_malloc(sizeof(*vdev_mlme)); - if (!vdev_mlme) { - mlme_err(" MLME component object alloc failed"); + if (!vdev_mlme) return QDF_STATUS_E_NOMEM; - } vdev_mlme->vdev = vdev; diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c index 76751396de86..28a3af75a6c4 100644 --- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c @@ -939,10 +939,9 @@ util_scan_add_hidden_ssid(struct wlan_objmgr_pdev *pdev, qdf_nbuf_t bcnbuf) * after ssid ie. */ tmp = qdf_mem_malloc(tmplen * sizeof(u_int8_t)); - if (!tmp) { - scm_debug("tmp memory alloc failed"); + if (!tmp) return QDF_STATUS_E_NOMEM; - } + /* Copy beacon data after ssid ie to tmp */ qdf_nbuf_copy_bits(bcnbuf, (sizeof(*hdr) + ssid_ie_end_offset), tmplen, tmp); @@ -1301,10 +1300,8 @@ static QDF_STATUS util_scan_parse_mbssid(struct wlan_objmgr_pdev *pdev, pos = ie; new_ie = qdf_mem_malloc(MAX_IE_LEN); - if (!new_ie) { - scm_err("Failed to allocate memory for new ie"); + if (!new_ie) return QDF_STATUS_E_NOMEM; - } while (pos < ie + ielen + 2) { tmp = util_scan_find_ie(WLAN_ELEMID_MULTIPLE_BSSID, pos, @@ -1356,7 +1353,6 @@ static QDF_STATUS util_scan_parse_mbssid(struct wlan_objmgr_pdev *pdev, new_frame = qdf_mem_malloc(new_frame_len); if (!new_frame) { qdf_mem_free(new_ie); - scm_err("failed to allocate memory"); return QDF_STATUS_E_NOMEM; } diff --git a/umac/wifi_pos/src/wifi_pos_main.c b/umac/wifi_pos/src/wifi_pos_main.c index 4bdad7e1017d..9fa45acf9b9e 100644 --- a/umac/wifi_pos/src/wifi_pos_main.c +++ b/umac/wifi_pos/src/wifi_pos_main.c @@ -319,7 +319,6 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc, num_valid_channels; buf = qdf_mem_malloc(len); if (!buf) { - wifi_pos_alert("malloc failed"); wlan_objmgr_pdev_release_ref(pdev, WLAN_WIFI_POS_CORE_ID); return QDF_STATUS_E_NOMEM; } @@ -416,7 +415,6 @@ static QDF_STATUS wifi_pos_process_app_reg_req(struct wlan_objmgr_psoc *psoc, + sizeof(uint8_t); app_reg_rsp = qdf_mem_malloc(rsp_len); if (!app_reg_rsp) { - wifi_pos_alert("malloc failed"); ret = QDF_STATUS_E_NOMEM; err = OEM_ERR_NULL_CONTEXT; goto app_reg_failed; @@ -505,7 +503,6 @@ QDF_STATUS wifi_pos_psoc_obj_created_notification( /* initialize wifi-pos psoc priv object */ wifi_pos_obj = qdf_mem_malloc(sizeof(*wifi_pos_obj)); if (!wifi_pos_obj) { - wifi_pos_alert("Mem alloc failed for wifi pos psoc priv obj"); wifi_pos_clear_psoc(); return QDF_STATUS_E_NOMEM; } @@ -613,10 +610,9 @@ int wifi_pos_oem_rsp_handler(struct wlan_objmgr_psoc *psoc, if (oem_rsp->rsp_len_2 + oem_rsp->dma_len) { /* stitch togther the msg data_1 + CIR/CFR + data_2 */ data = qdf_mem_malloc(len); - if (!data) { - wifi_pos_err("malloc failed"); + if (!data) return -ENOMEM; - } + qdf_mem_copy(data, oem_rsp->data_1, oem_rsp->rsp_len_1); qdf_mem_copy(&data[oem_rsp->rsp_len_1], oem_rsp->vaddr, oem_rsp->dma_len);