From e7afbe980416a22fd5f3823b31f53be1a22d9668 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Mon, 18 Mar 2019 13:43:43 -0700 Subject: [PATCH] qcacld-3.0: cds: Replace explicit comparison to NULL Per the Linux Kernel coding style, as enforced by the kernel checkpatch script, pointers should not be explicitly compared to NULL. Therefore within cds replace any such comparisons with logical operations performed on the pointer itself. Change-Id: Ib542e8e26c16dd0d6afccb0fd94bca75a89b21e1 CRs-Fixed: 2418395 --- core/cds/src/cds_api.c | 24 ++++++++++++------------ core/cds/src/cds_packet.c | 12 ++++++------ core/cds/src/cds_sched.c | 16 ++++++++-------- core/cds/src/cds_utils.c | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 394bf610970c0..e52fdb527357b 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -121,7 +121,7 @@ static QDF_STATUS cds_recovery_work_init(void) cds_trigger_recovery_work, &__cds_recovery_caller); gp_cds_context->cds_recovery_wq = qdf_create_workqueue("cds_recovery_workqueue"); - if (NULL == gp_cds_context->cds_recovery_wq) { + if (!gp_cds_context->cds_recovery_wq) { cds_err("Failed to create cds_recovery_workqueue"); return QDF_STATUS_E_FAILURE; } @@ -275,10 +275,10 @@ cds_cfg_update_ac_specs_params(struct txrx_pdev_cfg_param_t *olcfg, { int i; - if (NULL == olcfg) + if (!olcfg) return; - if (NULL == cds_cfg) + if (!cds_cfg) return; for (i = 0; i < OL_TX_NUM_WMM_AC; i++) { @@ -438,7 +438,7 @@ cds_set_ac_specs_params(struct cds_config_info *cds_cfg) int i; struct cds_context *cds_ctx; - if (NULL == cds_cfg) + if (!cds_cfg) return; cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); @@ -1216,7 +1216,7 @@ void *cds_get_context(QDF_MODULE_ID module_id) { void *context = NULL; - if (gp_cds_context == NULL) { + if (!gp_cds_context) { cds_err("cds context pointer is null"); return NULL; } @@ -1318,7 +1318,7 @@ void *cds_get_context(QDF_MODULE_ID module_id) */ void *cds_get_global_context(void) { - if (gp_cds_context == NULL) { + if (!gp_cds_context) { /* * To avoid recursive call, this should not change to * QDF_TRACE(). @@ -1338,7 +1338,7 @@ void *cds_get_global_context(void) */ enum cds_driver_state cds_get_driver_state(void) { - if (gp_cds_context == NULL) { + if (!gp_cds_context) { cds_err("global cds context is NULL"); return CDS_DRIVER_STATE_UNINITIALIZED; @@ -1359,7 +1359,7 @@ enum cds_driver_state cds_get_driver_state(void) */ void cds_set_driver_state(enum cds_driver_state state) { - if (gp_cds_context == NULL) { + if (!gp_cds_context) { cds_err("global cds context is NULL: %x", state); return; @@ -1379,7 +1379,7 @@ void cds_set_driver_state(enum cds_driver_state state) */ void cds_clear_driver_state(enum cds_driver_state state) { - if (gp_cds_context == NULL) { + if (!gp_cds_context) { cds_err("global cds context is NULL: %x", state); return; @@ -1654,7 +1654,7 @@ bool cds_is_packet_log_enabled(void) struct hdd_context *hdd_ctx; hdd_ctx = gp_cds_context->hdd_context; - if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) { + if ((!hdd_ctx) || (!hdd_ctx->config)) { cds_alert("Hdd Context is Null"); return false; } @@ -2189,7 +2189,7 @@ bool cds_is_ptp_rx_opt_enabled(void) } hdd_ctx = (struct hdd_context *)(p_cds_context->hdd_context); - if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) { + if ((!hdd_ctx) || (!hdd_ctx->config)) { cds_err("Hdd Context is Null"); return false; } @@ -2209,7 +2209,7 @@ bool cds_is_ptp_tx_opt_enabled(void) } hdd_ctx = (struct hdd_context *)(p_cds_context->hdd_context); - if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) { + if ((!hdd_ctx) || (!hdd_ctx->config)) { cds_err("Hdd Context is Null"); return false; } diff --git a/core/cds/src/cds_packet.c b/core/cds/src/cds_packet.c index 59f06875814ee..50e18eb5de81b 100644 --- a/core/cds/src/cds_packet.c +++ b/core/cds/src/cds_packet.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2016, 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 @@ -47,7 +47,7 @@ QDF_STATUS cds_pkt_return_packet(cds_pkt_t *packet) { /* Validate the input parameter pointer */ - if (unlikely(packet == NULL)) { + if (unlikely(!packet)) { return QDF_STATUS_E_INVAL; } @@ -81,8 +81,8 @@ QDF_STATUS cds_pkt_get_packet_length(cds_pkt_t *pPacket, uint16_t *pPacketSize) { /* Validate the parameter pointers */ - if (unlikely((pPacket == NULL) || (pPacketSize == NULL)) || - (pPacket->pkt_buf == NULL)) { + if (unlikely((!pPacket) || (!pPacketSize)) || + (!pPacket->pkt_buf)) { cds_alert("NULL pointer"); return QDF_STATUS_E_INVAL; } @@ -107,7 +107,7 @@ QDF_STATUS cds_packet_alloc_debug(uint16_t size, void **data, void **ppPacket, TX_PKT_MIN_HEADROOM, sizeof(uint32_t), false, file_name, line_num); - if (nbuf != NULL) { + if (nbuf) { qdf_nbuf_put_tail(nbuf, size); qdf_nbuf_set_protocol(nbuf, ETH_P_CONTROL); *ppPacket = nbuf; @@ -130,7 +130,7 @@ QDF_STATUS cds_packet_alloc(uint16_t size, void **data, void **ppPacket) nbuf = qdf_nbuf_alloc(NULL, roundup(size + TX_PKT_MIN_HEADROOM, 4), TX_PKT_MIN_HEADROOM, sizeof(uint32_t), false); - if (nbuf != NULL) { + if (nbuf) { qdf_nbuf_put_tail(nbuf, size); qdf_nbuf_set_protocol(nbuf, ETH_P_CONTROL); *ppPacket = nbuf; diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c index bb76a43bc6b63..576abdc2b51d1 100644 --- a/core/cds/src/cds_sched.c +++ b/core/cds/src/cds_sched.c @@ -412,7 +412,7 @@ QDF_STATUS cds_sched_open(void *p_cds_context, { cds_debug("Opening the CDS Scheduler"); /* Sanity checks */ - if ((p_cds_context == NULL) || (pSchedContext == NULL)) { + if ((!p_cds_context) || (!pSchedContext)) { cds_err("Null params being passed"); return QDF_STATUS_E_FAILURE; } @@ -622,7 +622,7 @@ QDF_STATUS cds_close_rx_thread(void) cds_debug("invoked"); if (!gp_cds_sched_context) { - cds_err("gp_cds_sched_context == NULL"); + cds_err("!gp_cds_sched_context"); return QDF_STATUS_E_FAILURE; } @@ -796,7 +796,7 @@ void cds_resume_rx_thread(void) p_cds_sched_context cds_sched_context; cds_sched_context = get_cds_sched_ctxt(); - if (NULL == cds_sched_context) { + if (!cds_sched_context) { cds_err("cds_sched_context is NULL"); return; } @@ -820,8 +820,8 @@ QDF_STATUS cds_sched_close(void) { cds_debug("invoked"); - if (gp_cds_sched_context == NULL) { - cds_err("gp_cds_sched_context == NULL"); + if (!gp_cds_sched_context) { + cds_err("!gp_cds_sched_context"); return QDF_STATUS_E_FAILURE; } @@ -838,8 +838,8 @@ QDF_STATUS cds_sched_close(void) p_cds_sched_context get_cds_sched_ctxt(void) { /* Make sure that Vos Scheduler context has been initialized */ - if (gp_cds_sched_context == NULL) - cds_err("gp_cds_sched_context == NULL"); + if (!gp_cds_sched_context) + cds_err("!gp_cds_sched_context"); return gp_cds_sched_context; } @@ -1002,7 +1002,7 @@ QDF_STATUS cds_shutdown_notifier_register(void (*cb)(void *priv), void *priv) notifier = qdf_mem_malloc(sizeof(*notifier)); - if (notifier == NULL) + if (!notifier) return QDF_STATUS_E_NOMEM; /* diff --git a/core/cds/src/cds_utils.c b/core/cds/src/cds_utils.c index 40d4e40a86ed0..80592a92de18f 100644 --- a/core/cds/src/cds_utils.c +++ b/core/cds/src/cds_utils.c @@ -318,7 +318,7 @@ cds_attach_mmie(uint8_t *igtk, uint8_t *ipn, uint16_t key_id, /* MIC = AES-128-CMAC(IGTK, AAD || Management Frame Body || MMIE, 64) */ nBytes = AAD_LEN + (frmLen - sizeof(struct ieee80211_frame)); input = (uint8_t *) qdf_mem_malloc(nBytes); - if (NULL == input) { + if (!input) { cds_err("Memory allocation failed"); ret = QDF_STATUS_E_NOMEM; goto err_tfm; @@ -420,7 +420,7 @@ cds_is_mmie_valid(uint8_t *igtk, uint8_t *ipn, uint8_t *frm, uint8_t *efrm) /* MIC = AES-128-CMAC(IGTK, AAD || Management Frame Body || MMIE, 64) */ nBytes = AAD_LEN + (efrm - (uint8_t *) (wh + 1)); input = (uint8_t *) qdf_mem_malloc(nBytes); - if (NULL == input) { + if (!input) { cds_err("Memory allocation failed"); ret = QDF_STATUS_E_NOMEM; goto err_tfm;