diff --git a/utils/epping/src/epping_helper.c b/utils/epping/src/epping_helper.c index b8317ccd1683..fe17d8241cc0 100644 --- a/utils/epping/src/epping_helper.c +++ b/utils/epping/src/epping_helper.c @@ -107,7 +107,7 @@ struct epping_cookie *epping_alloc_cookie(epping_context_t *pEpping_ctx) qdf_spin_lock_bh(&pEpping_ctx->cookie_lock); cookie = pEpping_ctx->cookie_list; - if (cookie != NULL) { + if (cookie) { pEpping_ctx->cookie_list = cookie->next; pEpping_ctx->cookie_count--; } diff --git a/utils/epping/src/epping_main.c b/utils/epping/src/epping_main.c index ecd9a511e0cb..1242930164b1 100644 --- a/utils/epping/src/epping_main.c +++ b/utils/epping/src/epping_main.c @@ -110,7 +110,7 @@ void epping_disable(void) } hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (hif_ctx == NULL) { + if (!hif_ctx) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: error: hif_ctx = NULL", __func__); return; @@ -119,7 +119,7 @@ void epping_disable(void) hif_reset_soc(hif_ctx); htc_handle = cds_get_context(QDF_MODULE_ID_HTC); - if (htc_handle == NULL) { + if (!htc_handle) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: error: htc_handle = NULL", __func__); return; @@ -145,7 +145,7 @@ void epping_close(void) { epping_context_t *to_free; - if (g_epping_ctx == NULL) { + if (!g_epping_ctx) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: error: g_epping_ctx = NULL", __func__); return; @@ -163,7 +163,7 @@ void epping_close(void) */ static void epping_target_suspend_acknowledge(void *context, bool wow_nack) { - if (NULL == g_epping_ctx) { + if (!g_epping_ctx) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: epping_ctx is NULL", __func__); return; @@ -251,7 +251,7 @@ int epping_enable(struct device *parent_dev, bool rtnl_held) p_cds_context = cds_get_global_context(); - if (p_cds_context == NULL) { + if (!p_cds_context) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: Failed cds_get_global_context", __func__); ret = -1; diff --git a/utils/epping/src/epping_rx.c b/utils/epping/src/epping_rx.c index f0d46079ffe7..0a5ae0b2654b 100644 --- a/utils/epping/src/epping_rx.c +++ b/utils/epping/src/epping_rx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-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 @@ -76,7 +76,7 @@ void epping_refill(void *ctx, HTC_ENDPOINT_ID Endpoint) for (RxBuffers = 0; RxBuffers < buffersToRefill; RxBuffers++) { osBuf = qdf_nbuf_alloc(NULL, AR6000_BUFFER_SIZE, AR6000_MIN_HEAD_ROOM, 4, false); - if (NULL == osBuf) { + if (!osBuf) { break; } /* the HTC packet wrapper is at the head of the reserved area diff --git a/utils/epping/src/epping_tx.c b/utils/epping/src/epping_tx.c index 48bc507c223f..b1969382eb8d 100644 --- a/utils/epping/src/epping_tx.c +++ b/utils/epping/src/epping_tx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-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 @@ -54,7 +54,7 @@ void epping_tx_dup_pkt(epping_adapter_t *adapter, qdf_nbuf_t new_skb; cookie = epping_alloc_cookie(adapter->pEpping_ctx); - if (cookie == NULL) { + if (!cookie) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: epping_alloc_cookie returns no resource\n", __func__); @@ -103,7 +103,7 @@ static int epping_tx_send_int(qdf_nbuf_t skb, epping_adapter_t *adapter) /* allocate resource for this packet */ cookie = epping_alloc_cookie(adapter->pEpping_ctx); /* no resource */ - if (cookie == NULL) { + if (!cookie) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: epping_alloc_cookie returns no resource\n", __func__); @@ -318,7 +318,7 @@ void epping_tx_complete(void *ctx, HTC_PACKET *htc_pkt) A_BOOL flushing = false; qdf_nbuf_queue_t skb_queue; - if (htc_pkt == NULL) + if (!htc_pkt) return; qdf_nbuf_queue_init(&skb_queue); @@ -381,7 +381,7 @@ void epping_tx_complete(void *ctx, HTC_PACKET *htc_pkt) while (qdf_nbuf_queue_len(&skb_queue)) { /* use non-lock version */ pktSkb = qdf_nbuf_queue_remove(&skb_queue); - if (pktSkb == NULL) + if (!pktSkb) break; qdf_nbuf_tx_free(pktSkb, QDF_NBUF_PKT_ERROR); pEpping_ctx->total_tx_acks++; diff --git a/utils/epping/src/epping_txrx.c b/utils/epping/src/epping_txrx.c index a4316be20148..5332f4a6ba13 100644 --- a/utils/epping/src/epping_txrx.c +++ b/utils/epping/src/epping_txrx.c @@ -50,14 +50,14 @@ static void epping_timer_expire(void *data) struct net_device *dev = (struct net_device *)data; epping_adapter_t *adapter; - if (dev == NULL) { + if (!dev) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: netdev = NULL", __func__); return; } adapter = netdev_priv(dev); - if (adapter == NULL) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: adapter = NULL", __func__); return; @@ -82,7 +82,7 @@ static int epping_ndev_stop(struct net_device *dev) int ret = 0; adapter = netdev_priv(dev); - if (NULL == adapter) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: EPPING adapter context is Null", __func__); ret = -ENODEV; @@ -98,7 +98,7 @@ static void epping_ndev_uninit(struct net_device *dev) epping_adapter_t *adapter; adapter = netdev_priv(dev); - if (NULL == adapter) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: EPPING adapter context is Null", __func__); goto end; @@ -113,7 +113,7 @@ static void epping_tx_queue_timeout(struct net_device *dev) epping_adapter_t *adapter; adapter = netdev_priv(dev); - if (NULL == adapter) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: EPPING adapter context is Null", __func__); goto end; @@ -142,7 +142,7 @@ static netdev_tx_t epping_hard_start_xmit(struct sk_buff *skb, int ret = 0; adapter = netdev_priv(dev); - if (NULL == adapter) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: EPPING adapter context is Null", __func__); kfree_skb(skb); @@ -159,7 +159,7 @@ static struct net_device_stats *epping_get_stats(struct net_device *dev) { epping_adapter_t *adapter = netdev_priv(dev); - if (NULL == adapter) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_ERROR, "%s: adapter = NULL", __func__); return NULL; @@ -174,7 +174,7 @@ static int epping_ndev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) int ret = 0; adapter = netdev_priv(dev); - if (NULL == adapter) { + if (!adapter) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: EPPING adapter context is Null", __func__); ret = -ENODEV; @@ -363,7 +363,7 @@ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, NET_NAME_UNKNOWN, #endif ether_setup); - if (dev == NULL) { + if (!dev) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: Cannot allocate epping_adapter_t\n", __func__); return NULL; diff --git a/utils/fwlog/dbglog_host.c b/utils/fwlog/dbglog_host.c index 7a913a126597..ad8c56f84d54 100644 --- a/utils/fwlog/dbglog_host.c +++ b/utils/fwlog/dbglog_host.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 @@ -1505,7 +1505,7 @@ static int dbglog_print_raw_data(uint32_t *buffer, uint32_t length) skip_args_processing: if (debugid < MAX_DBG_MSGS) { dbgidString = DBG_MSG_ARR[moduleid][debugid]; - if (dbgidString != NULL) { + if (dbgidString) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("fw:%s(%x %x):%s\n", dbgidString, timestamp, @@ -2053,7 +2053,7 @@ int dbglog_parse_debug_logs(ol_scn_t scn, uint8_t *data, uint32_t datalen) if (moduleid >= WLAN_MODULE_ID_MAX) return A_OK; - if (mod_print[moduleid] == NULL) { + if (!mod_print[moduleid]) { /* * No module specific log registered * use the default handler diff --git a/utils/logging/src/wlan_logging_sock_svc.c b/utils/logging/src/wlan_logging_sock_svc.c index 9d8d0b863e12..877b249d12ec 100644 --- a/utils/logging/src/wlan_logging_sock_svc.c +++ b/utils/logging/src/wlan_logging_sock_svc.c @@ -569,7 +569,7 @@ static int pktlog_send_per_pkt_stats_to_user(void) while (!list_empty(&gwlan_logging.pkt_stat_filled_list) && !gwlan_logging.exit) { skb_new = dev_alloc_skb(MAX_SKBMSG_LENGTH); - if (skb_new == NULL) { + if (!skb_new) { if (!rate_limit) { pr_err("%s: dev_alloc_skb() failed for msg size[%d] drop count = %u\n", __func__, MAX_SKBMSG_LENGTH, @@ -645,7 +645,7 @@ static int send_filled_buffers_to_user(void) && !gwlan_logging.exit) { skb = dev_alloc_skb(MAX_LOGMSG_LENGTH); - if (skb == NULL) { + if (!skb) { if (!rate_limit) { pr_err ("%s: dev_alloc_skb() failed for msg size[%d] drop count = %u\n", @@ -671,7 +671,7 @@ static int send_filled_buffers_to_user(void) tot_msg_len = NLMSG_SPACE(payload_len); nlh = nlmsg_put(skb, 0, nlmsg_seq++, ANI_NL_MSG_LOG, payload_len, NLM_F_REQUEST); - if (NULL == nlh) { + if (!nlh) { spin_lock_irqsave(&gwlan_logging.spin_lock, flags); list_add_tail(&plog_msg->node, &gwlan_logging.free_list); @@ -980,7 +980,7 @@ int wlan_logging_sock_init_svc(void) for (i = 0; i < MAX_PKTSTATS_BUFF; i++) { gpkt_stats_buffers[i].skb = dev_alloc_skb(MAX_PKTSTATS_LENGTH); - if (gpkt_stats_buffers[i].skb == NULL) { + if (!gpkt_stats_buffers[i].skb) { pr_err("%s: Memory alloc failed for skb", __func__); /* free previously allocated skb and return */ for (j = 0; j < i ; j++) @@ -1235,7 +1235,7 @@ void wlan_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data) pktlog_hdr = (struct ath_pktlog_hdr *)pl_hdr; - if (pktlog_hdr == NULL) { + if (!pktlog_hdr) { pr_err("%s : Invalid pkt_stats_header\n", __func__); return; } diff --git a/utils/nlink/src/wlan_nlink_srv.c b/utils/nlink/src/wlan_nlink_srv.c index 785b71a54478..171d599e10f0 100644 --- a/utils/nlink/src/wlan_nlink_srv.c +++ b/utils/nlink/src/wlan_nlink_srv.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 @@ -195,7 +195,7 @@ int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) return ret; if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && - msg_handler != NULL) { + msg_handler) { ret = cnss_logger_event_unregister(radio_idx, msg_type, msg_handler); } else { @@ -226,7 +226,7 @@ int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) return ret; if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && - msg_handler != NULL) { + msg_handler) { ret = cnss_logger_event_register(radio_idx, msg_type, msg_handler); } else { @@ -508,7 +508,7 @@ int nl_srv_init(void *wiphy) nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_PROTO_FAMILY, &cfg); - if (nl_srv_sock != NULL) { + if (nl_srv_sock) { memset(nl_srv_msg_handler, 0, sizeof(nl_srv_msg_handler)); } else { QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, @@ -540,7 +540,7 @@ int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) int retcode = 0; if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && - msg_handler != NULL) { + msg_handler) { nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = msg_handler; } else { QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, @@ -708,7 +708,7 @@ static void nl_srv_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) type -= WLAN_NL_MSG_BASE; /* dispatch to handler */ - if (nl_srv_msg_handler[type] != NULL) { + if (nl_srv_msg_handler[type]) { (nl_srv_msg_handler[type])(skb); } else { QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, diff --git a/utils/pktlog/linux_ac.c b/utils/pktlog/linux_ac.c index 769e9d64d95d..c25fcde048d0 100644 --- a/utils/pktlog/linux_ac.c +++ b/utils/pktlog/linux_ac.c @@ -113,7 +113,7 @@ int pktlog_alloc_buf(struct hif_opaque_softc *scn) page_cnt = (sizeof(*(pl_info->buf)) + pl_info->buf_size) / PAGE_SIZE; qdf_spin_lock_bh(&pl_info->log_lock); - if (pl_info->buf != NULL) { + if (pl_info->buf) { qdf_spin_unlock_bh(&pl_info->log_lock); printk(PKTLOG_TAG "Buffer is already in use\n"); return -EINVAL; @@ -121,7 +121,7 @@ int pktlog_alloc_buf(struct hif_opaque_softc *scn) qdf_spin_unlock_bh(&pl_info->log_lock); buffer = vmalloc((page_cnt + 2) * PAGE_SIZE); - if (buffer == NULL) { + if (!buffer) { printk(PKTLOG_TAG "%s: Unable to allocate buffer " "(%d pages)\n", __func__, page_cnt); @@ -140,7 +140,7 @@ int pktlog_alloc_buf(struct hif_opaque_softc *scn) } qdf_spin_lock_bh(&pl_info->log_lock); - if (pl_info->buf != NULL) + if (pl_info->buf) pktlog_release_buf(scn); pl_info->buf = buffer; @@ -418,9 +418,9 @@ static int pktlog_attach(struct hif_opaque_softc *scn) /* Allocate pktlog dev for later use */ pl_dev = get_pktlog_handle(); - if (pl_dev != NULL) { + if (pl_dev) { pl_info_lnx = kmalloc(sizeof(*pl_info_lnx), GFP_KERNEL); - if (pl_info_lnx == NULL) { + if (!pl_info_lnx) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, "%s: Allocation failed for pl_info", __func__); @@ -454,7 +454,7 @@ static int pktlog_attach(struct hif_opaque_softc *scn) g_pktlog_pde, &pktlog_fops, &pl_info_lnx->info); - if (proc_entry == NULL) { + if (!proc_entry) { printk(PKTLOG_TAG "%s: create_proc_entry failed for %s\n", __func__, proc_name); goto attach_fail1; @@ -701,7 +701,7 @@ pktlog_read_proc_entry(char *buf, size_t nbytes, loff_t *ppos, *read_complete = false; - if (log_buf == NULL) { + if (!log_buf) { *read_complete = true; qdf_spin_unlock_bh(&pl_info->log_lock); return 0; @@ -842,7 +842,7 @@ __pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) qdf_spin_lock_bh(&pl_info->log_lock); log_buf = pl_info->buf; - if (log_buf == NULL) { + if (!log_buf) { qdf_spin_unlock_bh(&pl_info->log_lock); return 0; } @@ -1005,7 +1005,7 @@ int pktlogmod_init(void *context) /* create the proc directory entry */ g_pktlog_pde = proc_mkdir(PKTLOG_PROC_DIR, NULL); - if (g_pktlog_pde == NULL) { + if (!g_pktlog_pde) { printk(PKTLOG_TAG "%s: proc_mkdir failed\n", __func__); return -EPERM; } @@ -1028,7 +1028,7 @@ attach_fail: void pktlogmod_exit(void *context) { - if (g_pktlog_pde == NULL) + if (!g_pktlog_pde) return; pktlog_detach((struct hif_opaque_softc *)context); diff --git a/utils/pktlog/pktlog_ac.c b/utils/pktlog/pktlog_ac.c index 77f6f6d51194..72e505c51fee 100644 --- a/utils/pktlog/pktlog_ac.c +++ b/utils/pktlog/pktlog_ac.c @@ -595,7 +595,7 @@ void pktlog_init(struct hif_opaque_softc *scn) struct pktlog_dev_t *pl_dev = get_pktlog_handle(); struct ath_pktlog_info *pl_info; - if (pl_dev == NULL || pl_dev->pl_info == NULL) { + if (!pl_dev || !pl_dev->pl_info) { qdf_print("pl_dev or pl_info is invalid"); return; } @@ -678,7 +678,7 @@ static int __pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state, } if (!pl_dev->tgt_pktlog_alloced) { - if (pl_info->buf == NULL) { + if (!pl_info->buf) { error = pktlog_alloc_buf(scn); if (error != 0) { @@ -846,7 +846,7 @@ static int __pktlog_setsize(struct hif_opaque_softc *scn, int32_t size) } qdf_spin_lock_bh(&pl_info->log_lock); - if (pl_info->buf != NULL) { + if (pl_info->buf) { if (pl_dev->is_pktlog_cb_subscribed && wdi_pktlog_unsubscribe(pdev, pl_info->log_state)) { pl_info->curr_pkt_state = @@ -934,7 +934,7 @@ int pktlog_clearbuff(struct hif_opaque_softc *scn, bool clear_buff) return -EINVAL; } - if (pl_info->buf != NULL) { + if (pl_info->buf) { if (pl_info->buf_size > 0) { qdf_print("%s: pktlog buffer is cleared.", __func__); memset(pl_info->buf, 0, pl_info->buf_size); diff --git a/utils/pktlog/pktlog_internal.c b/utils/pktlog/pktlog_internal.c index 2f67b435e482..2c0c4672bf89 100644 --- a/utils/pktlog/pktlog_internal.c +++ b/utils/pktlog/pktlog_internal.c @@ -1424,7 +1424,7 @@ int process_rx_desc_remote(void *pdev, void *data) rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info, log_size, &pl_hdr); - if (rxstat_log.rx_desc == NULL) { + if (!rxstat_log.rx_desc) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG, "%s: Rx descriptor is NULL", __func__); return -EFAULT; @@ -1456,7 +1456,7 @@ process_pktlog_lite(void *context, void *log_data, uint16_t log_type) log_size = pl_hdr.size; rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info, log_size, &pl_hdr); - if (rxstat_log.rx_desc == NULL) { + if (!rxstat_log.rx_desc) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG, "%s: Rx descriptor is NULL", __func__); return -EFAULT; diff --git a/utils/ptt/src/wlan_ptt_sock_svc.c b/utils/ptt/src/wlan_ptt_sock_svc.c index 089f29ef7b87..4b8d54de2198 100644 --- a/utils/ptt/src/wlan_ptt_sock_svc.c +++ b/utils/ptt/src/wlan_ptt_sock_svc.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 @@ -134,7 +134,7 @@ int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid) payload_len = wmsg_length + sizeof(wnl->radio) + sizeof(*wmsg); tot_msg_len = NLMSG_SPACE(payload_len); skb = dev_alloc_skb(tot_msg_len); - if (skb == NULL) { + if (!skb) { PTT_TRACE(QDF_TRACE_LEVEL_ERROR, "%s: dev_alloc_skb() failed for msg size[%d]\n", __func__, tot_msg_len); @@ -143,7 +143,7 @@ int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid) nlh = nlmsg_put(skb, pid, nlmsg_seq++, src_mod, payload_len, NLM_F_REQUEST); - if (NULL == nlh) { + if (!nlh) { PTT_TRACE(QDF_TRACE_LEVEL_ERROR, "%s: nlmsg_put() failed for msg size[%d]\n", __func__, tot_msg_len);