From 0c5bdd7e73924a17c4d3bd4ed7dcda5e4ae646d2 Mon Sep 17 00:00:00 2001 From: Madhvapathi Sriram Date: Mon, 7 Jan 2019 09:30:48 +0530 Subject: [PATCH] qcacmn: Remove error log for qdf_mem_malloc in target_if files qdf layer already has the error trace Change-Id: I2d752fafb6ee805206047bae9711aa0387f22f69 CRs-Fixed: 2376430 --- target_if/core/src/target_if_main.c | 9 +--- .../cp_stats/src/target_if_mc_cp_stats.c | 23 +++------ .../src/target_if_direct_buf_rx_main.c | 20 ++------ .../init_deinit/src/service_ready_util.c | 4 +- target_if/regulatory/src/target_if_reg.c | 4 +- target_if/scan/src/target_if_scan.c | 14 ++---- target_if/spectral/target_if_spectral.c | 5 +- target_if/spectral/target_if_spectral_sim.c | 50 +++++-------------- .../spectral/target_if_spectral_sim_int.h | 3 +- target_if/wifi_pos/src/target_if_wifi_pos.c | 23 +++------ 10 files changed, 43 insertions(+), 112 deletions(-) diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 6c1623548f98..2a439eac8a3a 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -141,7 +141,6 @@ QDF_STATUS target_if_init(get_psoc_handle_callback psoc_hdl_cb) { g_target_if_ctx = qdf_mem_malloc(sizeof(*g_target_if_ctx)); if (!g_target_if_ctx) { - target_if_err("Cannot allocate target if ctx"); QDF_ASSERT(0); return QDF_STATUS_E_NOMEM; } @@ -501,10 +500,8 @@ QDF_STATUS target_if_alloc_pdev_tgt_info(struct wlan_objmgr_pdev *pdev) tgt_pdev_info = qdf_mem_malloc(sizeof(*tgt_pdev_info)); - if (tgt_pdev_info == NULL) { - target_if_err("Failed to allocate pdev target info"); + if (!tgt_pdev_info) return QDF_STATUS_E_NOMEM; - } wlan_pdev_set_tgt_if_handle(pdev, tgt_pdev_info); @@ -540,10 +537,8 @@ QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc) tgt_psoc_info = qdf_mem_malloc(sizeof(*tgt_psoc_info)); - if (tgt_psoc_info == NULL) { - target_if_err("Failed to allocate psoc target info"); + if (!tgt_psoc_info) return QDF_STATUS_E_NOMEM; - } wlan_psoc_set_tgt_if_handle(psoc, tgt_psoc_info); target_psoc_set_preferred_hw_mode(tgt_psoc_info, WMI_HOST_HW_MODE_MAX); diff --git a/target_if/cp_stats/src/target_if_mc_cp_stats.c b/target_if/cp_stats/src/target_if_mc_cp_stats.c index d3e620bff867..46fa14d1bf89 100644 --- a/target_if/cp_stats/src/target_if_mc_cp_stats.c +++ b/target_if/cp_stats/src/target_if_mc_cp_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-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 @@ -69,10 +69,8 @@ static QDF_STATUS target_if_cp_stats_extract_pdev_stats( */ ev->pdev_stats = qdf_mem_malloc(sizeof(*ev->pdev_stats) * ev->num_pdev_stats); - if (!ev->pdev_stats) { - cp_stats_err("malloc failed"); + if (!ev->pdev_stats) return QDF_STATUS_E_NOMEM; - } for (i = 0; i < ev->num_pdev_stats; i++) { status = wmi_extract_pdev_stats(wmi_hdl, data, i, &pdev_stats); @@ -103,10 +101,8 @@ static QDF_STATUS target_if_cp_stats_extract_peer_stats( ev->peer_stats = qdf_mem_malloc(sizeof(*ev->peer_stats) * ev->num_peer_stats); - if (!ev->peer_stats) { - cp_stats_err("malloc failed"); + if (!ev->peer_stats) return QDF_STATUS_E_NOMEM; - } db2dbm_enabled = wmi_service_enabled(wmi_hdl, wmi_service_hw_db2dbm_support); @@ -145,10 +141,8 @@ static QDF_STATUS target_if_cp_stats_extract_cca_stats( } ev->cca_stats = qdf_mem_malloc(sizeof(*ev->cca_stats)); - if (!ev->cca_stats) { - cp_stats_err("malloc failed"); + if (!ev->cca_stats) return QDF_STATUS_E_NOMEM; - } ev->cca_stats->vdev_id = stats.vdev_id; @@ -175,10 +169,8 @@ static QDF_STATUS target_if_cp_stats_extract_vdev_summary_stats( ev->vdev_summary_stats = qdf_mem_malloc(sizeof(*ev->vdev_summary_stats) * ev->num_summary_stats); - if (!ev->vdev_summary_stats) { - cp_stats_err("malloc failed"); + if (!ev->vdev_summary_stats) return QDF_STATUS_E_NOMEM; - } db2dbm_enabled = wmi_service_enabled(wmi_hdl, wmi_service_hw_db2dbm_support); @@ -241,10 +233,9 @@ static QDF_STATUS target_if_cp_stats_extract_vdev_chain_rssi_stats( ev->vdev_chain_rssi = qdf_mem_malloc(sizeof(*ev->vdev_chain_rssi) * ev->num_chain_rssi_stats); - if (!ev->vdev_chain_rssi) { - cp_stats_err("malloc failed"); + if (!ev->vdev_chain_rssi) return QDF_STATUS_E_NOMEM; - } + db2dbm_enabled = wmi_service_enabled(wmi_hdl, wmi_service_hw_db2dbm_support); for (i = 0; i < ev->num_chain_rssi_stats; i++) { diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c index 4d4c88f490a6..c1857fcb06d3 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c @@ -147,10 +147,8 @@ QDF_STATUS target_if_direct_buf_rx_pdev_create_handler( dbr_pdev_obj = qdf_mem_malloc(sizeof(*dbr_pdev_obj)); - if (dbr_pdev_obj == NULL) { - direct_buf_rx_err("Failed to allocate dir buf rx pdev obj"); + if (!dbr_pdev_obj) return QDF_STATUS_E_NOMEM; - } direct_buf_rx_info("Dbr pdev obj %pK", dbr_pdev_obj); @@ -178,8 +176,7 @@ QDF_STATUS target_if_direct_buf_rx_pdev_create_handler( dbr_pdev_obj->dbr_mod_param = qdf_mem_malloc(num_modules * sizeof(struct direct_buf_rx_module_param)); - if (dbr_pdev_obj->dbr_mod_param == NULL) { - direct_buf_rx_err("Failed to allocate dir buf rx mod param"); + if (!dbr_pdev_obj->dbr_mod_param) { wlan_objmgr_pdev_component_obj_detach(pdev, WLAN_TARGET_IF_COMP_DIRECT_BUF_RX, dbr_pdev_obj); @@ -247,10 +244,8 @@ QDF_STATUS target_if_direct_buf_rx_psoc_create_handler( dbr_psoc_obj = qdf_mem_malloc(sizeof(*dbr_psoc_obj)); - if (!dbr_psoc_obj) { - direct_buf_rx_err("failed to alloc dir buf rx psoc obj"); + if (!dbr_psoc_obj) return QDF_STATUS_E_NOMEM; - } direct_buf_rx_info("Dbr psoc obj %pK", dbr_psoc_obj); @@ -470,10 +465,8 @@ static QDF_STATUS target_if_dbr_init_ring(struct wlan_objmgr_pdev *pdev, dbr_ring_cfg->num_ptr = num_entries; mod_param->dbr_buf_pool = qdf_mem_malloc(num_entries * sizeof( struct direct_buf_rx_buf_info)); - if (!mod_param->dbr_buf_pool) { - direct_buf_rx_err("dir buf rx buf pool alloc failed"); + if (!mod_param->dbr_buf_pool) return QDF_STATUS_E_NOMEM; - } ring_alloc_size = (num_entries * entry_size) + DBR_RING_BASE_ALIGN - 1; dbr_ring_cfg->ring_alloc_size = ring_alloc_size; @@ -538,17 +531,14 @@ static QDF_STATUS target_if_dbr_init_srng(struct wlan_objmgr_pdev *pdev, mod_param->dbr_ring_cap = qdf_mem_malloc(sizeof( struct direct_buf_rx_ring_cap)); - if (!mod_param->dbr_ring_cap) { - direct_buf_rx_err("Ring cap alloc failed"); + if (!mod_param->dbr_ring_cap) return QDF_STATUS_E_NOMEM; - } /* Allocate memory for DBR Ring Config */ mod_param->dbr_ring_cfg = qdf_mem_malloc(sizeof( struct direct_buf_rx_ring_cfg)); if (!mod_param->dbr_ring_cfg) { - direct_buf_rx_err("Ring config alloc failed"); qdf_mem_free(mod_param->dbr_ring_cap); return QDF_STATUS_E_NOMEM; } diff --git a/target_if/init_deinit/src/service_ready_util.c b/target_if/init_deinit/src/service_ready_util.c index ec863eee09e7..95f3aa03f12d 100644 --- a/target_if/init_deinit/src/service_ready_util.c +++ b/target_if/init_deinit/src/service_ready_util.c @@ -365,10 +365,8 @@ int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc, sizeof(struct wlan_psoc_host_dbr_ring_caps) * num_dbr_ring_caps); - if (!info->dbr_ring_cap) { - target_if_err("Mem alloc for DMA cap failed"); + if (!info->dbr_ring_cap) return -EINVAL; - } for (cap_idx = 0; cap_idx < num_dbr_ring_caps; cap_idx++) { status = wmi_extract_dbr_ring_cap_service_ready_ext(handle, diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index c6739e4cfaa1..df774a552b35 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -150,10 +150,8 @@ static int tgt_reg_chan_list_update_handler(ol_scn_t handle, uint8_t *event_buf, } reg_info = qdf_mem_malloc(sizeof(*reg_info)); - if (!reg_info) { - target_if_err("memory allocation failed"); + if (!reg_info) return -ENOMEM; - } if (wmi_extract_reg_chan_list_update_event(wmi_handle, event_buf, reg_info, len) diff --git a/target_if/scan/src/target_if_scan.c b/target_if/scan/src/target_if_scan.c index 2c90e18120dc..b63b38b2595f 100644 --- a/target_if/scan/src/target_if_scan.c +++ b/target_if/scan/src/target_if_scan.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 @@ -63,10 +63,8 @@ target_if_scan_event_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen) event_info = qdf_mem_malloc(sizeof(*event_info)); - if (!event_info) { - target_if_err("unable to allocate scan_event"); + if (!event_info) return -ENOMEM; - } if (wmi_extract_vdev_scan_ev_param(wmi_handle, data, &(event_info->event))) { @@ -115,10 +113,8 @@ int target_if_nlo_complete_handler(ol_scn_t scn, uint8_t *data, } event_info = qdf_mem_malloc(sizeof(*event_info)); - if (!event_info) { - target_if_err("unable to allocate scan_event"); + if (!event_info) return -ENOMEM; - } nlo_event = param_buf->fixed_param; target_if_debug("PNO complete event received for vdev %d", @@ -165,10 +161,8 @@ int target_if_nlo_match_event_handler(ol_scn_t scn, uint8_t *data, } event_info = qdf_mem_malloc(sizeof(*event_info)); - if (!event_info) { - target_if_err("unable to allocate scan_event"); + if (!event_info) return -ENOMEM; - } nlo_event = param_buf->fixed_param; target_if_debug("PNO match event received for vdev %d", diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index 86fa72bd7cb1..83866ffe436a 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -1875,10 +1875,9 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) } spectral = (struct target_if_spectral *)qdf_mem_malloc( sizeof(struct target_if_spectral)); - if (!spectral) { - spectral_err("SPECTRAL : Memory allocation failed"); + if (!spectral) return spectral; - } + qdf_mem_zero(spectral, sizeof(struct target_if_spectral)); /* Store pdev in Spectral */ spectral->pdev_obj = pdev; diff --git a/target_if/spectral/target_if_spectral_sim.c b/target_if/spectral/target_if_spectral_sim.c index d35cc2ad7767..40378bbaae7c 100644 --- a/target_if/spectral/target_if_spectral_sim.c +++ b/target_if/spectral/target_if_spectral_sim.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015,2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2015,2017-2019 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -85,10 +85,8 @@ target_if_populate_report_static_gen2( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_20_gen2)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_20_gen2); qdf_mem_copy(report->data, @@ -106,10 +104,8 @@ target_if_populate_report_static_gen2( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_40_gen2)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_40_gen2); qdf_mem_copy(report->data, @@ -127,10 +123,8 @@ target_if_populate_report_static_gen2( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_80_gen2)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_80_gen2); qdf_mem_copy(report->data, @@ -149,10 +143,8 @@ target_if_populate_report_static_gen2( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_80_80_gen2)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_80_80_gen2); qdf_mem_copy(report->data, @@ -171,10 +163,8 @@ target_if_populate_report_static_gen2( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_160_gen2)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_160_gen2); qdf_mem_copy(report->data, @@ -223,10 +213,8 @@ target_if_populate_report_static_gen3( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_20_gen3)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_20_gen3); qdf_mem_copy(report->data, @@ -244,10 +232,8 @@ target_if_populate_report_static_gen3( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_40_gen3)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_40_gen3); qdf_mem_copy(report->data, @@ -265,10 +251,8 @@ target_if_populate_report_static_gen3( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_80_gen3)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_80_gen3); qdf_mem_copy(report->data, @@ -287,10 +271,8 @@ target_if_populate_report_static_gen3( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_80_80_gen3)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_80_80_gen3); qdf_mem_copy(report->data, @@ -309,10 +291,8 @@ target_if_populate_report_static_gen3( report->data = (uint8_t *) qdf_mem_malloc(sizeof(reportdata_160_gen3)); - if (!report->data) { - spectral_err("Spectral simulation: Could not allocate memory for report data"); + if (!report->data) goto bad; - } report->datasize = sizeof(reportdata_160_gen3); qdf_mem_copy(report->data, @@ -390,10 +370,8 @@ target_if_populate_reportset_static( report = (struct spectralsim_report *) qdf_mem_malloc(sizeof(struct spectralsim_report)); - if (!report) { - spectral_err("Spectral simulation: Could not allocate memory for report."); + if (!report) goto bad; - } qdf_mem_zero(report, sizeof(*report)); @@ -660,10 +638,8 @@ target_if_spectral_sim_attach(struct target_if_spectral *spectral) simctx = (struct spectralsim_context *) qdf_mem_malloc(sizeof(struct spectralsim_context)); - if (!simctx) { - spectral_err("Spectral simulation: Could not allocate memory for context"); + if (!simctx) return -EPERM; - } qdf_mem_zero(simctx, sizeof(*simctx)); diff --git a/target_if/spectral/target_if_spectral_sim_int.h b/target_if/spectral/target_if_spectral_sim_int.h index 0bc58401531b..aa0fa00957ac 100644 --- a/target_if/spectral/target_if_spectral_sim_int.h +++ b/target_if/spectral/target_if_spectral_sim_int.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015,2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2015,2017-2019 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -126,7 +126,6 @@ struct spectralsim_context { qdf_mem_malloc(sizeof(struct spectralsim_reportset)); \ \ if ((reportset) == NULL) { \ - spectral_err("Spectral simulation: Could not allocate memory for report set"); \ target_if_depopulate_simdata((simctx)); \ return -EPERM; \ } \ diff --git a/target_if/wifi_pos/src/target_if_wifi_pos.c b/target_if/wifi_pos/src/target_if_wifi_pos.c index f9592196e578..dd0742ef2ebd 100644 --- a/target_if/wifi_pos/src/target_if_wifi_pos.c +++ b/target_if/wifi_pos/src/target_if_wifi_pos.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-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 @@ -414,10 +414,9 @@ static QDF_STATUS target_if_wifi_pos_fill_ring(uint8_t ring_idx, for (i = 0; i < priv->dma_cfg[ring_idx].num_ptr; i++) { buf = qdf_mem_malloc(priv->dma_cap[ring_idx].min_buf_size + priv->dma_cap[ring_idx].min_buf_align - 1); - if (!buf) { - target_if_err("malloc failed"); + if (!buf) return QDF_STATUS_E_NOMEM; - } + priv->dma_buf_pool[ring_idx][i].vaddr = buf; buf_aligned = (void *)qdf_roundup((uint64_t)buf, priv->dma_cap[ring_idx].min_buf_align); @@ -463,10 +462,8 @@ static QDF_STATUS target_if_wifi_pos_init_ring(uint8_t ring_idx, priv->dma_cfg[ring_idx].num_ptr = num_entries; priv->dma_buf_pool[ring_idx] = qdf_mem_malloc(num_entries * sizeof(struct wifi_pos_dma_buf_info)); - if (!priv->dma_buf_pool[ring_idx]) { - target_if_err("malloc failed"); + if (!priv->dma_buf_pool[ring_idx]) return QDF_STATUS_E_NOMEM; - } ring_alloc_size = (num_entries * entry_size) + RING_BASE_ALIGN - 1; priv->dma_cfg[ring_idx].ring_alloc_size = ring_alloc_size; @@ -529,17 +526,13 @@ static QDF_STATUS target_if_wifi_pos_init_srngs( /* allocate memory for num_rings pointers */ priv->dma_cfg = qdf_mem_malloc(priv->num_rings * sizeof(struct wifi_pos_dma_rings_cap)); - if (!priv->dma_cfg) { - target_if_err("malloc failed"); + if (!priv->dma_cfg) return QDF_STATUS_E_NOMEM; - } priv->dma_buf_pool = qdf_mem_malloc(priv->num_rings * sizeof(struct wifi_pos_dma_buf_info *)); - if (!priv->dma_buf_pool) { - target_if_err("malloc failed"); + if (!priv->dma_buf_pool) return QDF_STATUS_E_NOMEM; - } for (i = 0; i < priv->num_rings; i++) { status = target_if_wifi_pos_init_ring(i, priv); @@ -635,10 +628,8 @@ QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc, priv->num_rings = num_mac; priv->dma_cap = qdf_mem_malloc(priv->num_rings * sizeof(struct wifi_pos_dma_rings_cap)); - if (!priv->dma_cap) { - target_if_err("unable to get wifi_pos psoc obj"); + if (!priv->dma_cap) return QDF_STATUS_E_NOMEM; - } for (i = 0; i < num_mac; i++) { priv->dma_cap[i].pdev_id = dma_cap[i].pdev_id;