diff mbox

[3/6] linux-generic: fix comparison to NULL

Message ID 1440516404-4177-3-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes Aug. 25, 2015, 3:26 p.m. UTC
Checkpatch requires that:
(entry == NULL) be written (!entry)
(entry != NULL) be written (entry)

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/odp_classification.c | 54 ++++++++++++++---------------
 platform/linux-generic/odp_crypto.c         |  2 +-
 platform/linux-generic/odp_errno.c          |  2 +-
 platform/linux-generic/odp_init.c           |  6 ++--
 platform/linux-generic/odp_packet.c         | 16 ++++-----
 platform/linux-generic/odp_packet_io.c      | 28 +++++++--------
 platform/linux-generic/odp_pool.c           | 16 ++++-----
 platform/linux-generic/odp_queue.c          | 16 ++++-----
 platform/linux-generic/odp_schedule.c       |  2 +-
 platform/linux-generic/odp_shared_memory.c  |  6 ++--
 platform/linux-generic/odp_system_info.c    | 14 ++++----
 platform/linux-generic/odp_thread.c         |  2 +-
 platform/linux-generic/odp_timer.c          |  2 +-
 13 files changed, 83 insertions(+), 83 deletions(-)

Comments

Mike Holmes Aug. 25, 2015, 4:47 p.m. UTC | #1
I did not consciously leave anything, I focused on linux-generic and just
tried to fix what I saw by repeatedly running the following and grouping
the fixes in to the patches.

find platform/linux-genric -name *.h -o -name *.c -exec ./scripts/odp_check
{} \;

I expect the same is needed for test and examples, that may be the
difference ?


On 25 August 2015 at 12:17, Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
wrote:

> I tried to check your patch against the large one I proposed before and
> see many differences.
> Did you willingly leave some of these behind? Or did you use a regexp
> which missed some?
>
> Nicolas
>
> On 08/25/2015 05:26 PM, Mike Holmes wrote:
> > Checkpatch requires that:
> > (entry == NULL) be written (!entry)
> > (entry != NULL) be written (entry)
> >
> > Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> > ---
> >  platform/linux-generic/odp_classification.c | 54
> ++++++++++++++---------------
> >  platform/linux-generic/odp_crypto.c         |  2 +-
> >  platform/linux-generic/odp_errno.c          |  2 +-
> >  platform/linux-generic/odp_init.c           |  6 ++--
> >  platform/linux-generic/odp_packet.c         | 16 ++++-----
> >  platform/linux-generic/odp_packet_io.c      | 28 +++++++--------
> >  platform/linux-generic/odp_pool.c           | 16 ++++-----
> >  platform/linux-generic/odp_queue.c          | 16 ++++-----
> >  platform/linux-generic/odp_schedule.c       |  2 +-
> >  platform/linux-generic/odp_shared_memory.c  |  6 ++--
> >  platform/linux-generic/odp_system_info.c    | 14 ++++----
> >  platform/linux-generic/odp_thread.c         |  2 +-
> >  platform/linux-generic/odp_timer.c          |  2 +-
> >  13 files changed, 83 insertions(+), 83 deletions(-)
> >
> > diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> > index 452631a..66e2049 100644
> > --- a/platform/linux-generic/odp_classification.c
> > +++ b/platform/linux-generic/odp_classification.c
> > @@ -62,7 +62,7 @@ int odp_classification_init_global(void)
> >       }
> >
> >       cos_tbl = odp_shm_addr(cos_shm);
> > -     if (cos_tbl == NULL)
> > +     if (!cos_tbl)
> >               goto error_cos;
> >
> >       memset(cos_tbl, 0, sizeof(cos_tbl_t));
> > @@ -83,7 +83,7 @@ int odp_classification_init_global(void)
> >       }
> >
> >       pmr_tbl = odp_shm_addr(pmr_shm);
> > -     if (pmr_tbl == NULL)
> > +     if (!pmr_tbl)
> >               goto error_pmr;
> >
> >       memset(pmr_tbl, 0, sizeof(pmr_tbl_t));
> > @@ -104,7 +104,7 @@ int odp_classification_init_global(void)
> >       }
> >
> >       pmr_set_tbl = odp_shm_addr(pmr_set_shm);
> > -     if (pmr_set_tbl == NULL)
> > +     if (!pmr_set_tbl)
> >               goto error_pmrset;
> >
> >       memset(pmr_set_tbl, 0, sizeof(pmr_set_tbl_t));
> > @@ -267,7 +267,7 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t
> queue_id)
> >  {
> >       cos_t *cos = get_cos_entry(cos_id);
> >
> > -     if (cos == NULL) {
> > +     if (!cos) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -281,7 +281,7 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e
> drop_policy)
> >  {
> >       cos_t *cos = get_cos_entry(cos_id);
> >
> > -     if (cos == NULL) {
> > +     if (!cos) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -297,12 +297,12 @@ int odp_pktio_default_cos_set(odp_pktio_t
> pktio_in, odp_cos_t default_cos)
> >       cos_t *cos;
> >
> >       entry = get_pktio_entry(pktio_in);
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> >       cos = get_cos_entry(default_cos);
> > -     if (cos == NULL) {
> > +     if (!cos) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -317,13 +317,13 @@ int odp_pktio_error_cos_set(odp_pktio_t pktio_in,
> odp_cos_t error_cos)
> >       cos_t *cos;
> >
> >       entry = get_pktio_entry(pktio_in);
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> >
> >       cos = get_cos_entry(error_cos);
> > -     if (cos == NULL) {
> > +     if (!cos) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -336,7 +336,7 @@ int odp_pktio_skip_set(odp_pktio_t pktio_in,
> uint32_t offset)
> >  {
> >       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -349,7 +349,7 @@ int odp_pktio_headroom_set(odp_pktio_t pktio_in,
> uint32_t headroom)
> >  {
> >       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> > @@ -367,7 +367,7 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
> >       cos_t *cos;
> >       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> > @@ -377,7 +377,7 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
> >       /* Update the L2 QoS table*/
> >       for (i = 0; i < num_qos; i++) {
> >               cos = get_cos_entry(cos_table[i]);
> > -             if (cos != NULL) {
> > +             if (cos) {
> >                       if (ODP_COS_MAX_L2_QOS > qos_table[i])
> >                               l2_cos->cos[qos_table[i]] = cos;
> >               }
> > @@ -397,7 +397,7 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
> >       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >       cos_t *cos;
> >
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> > @@ -409,7 +409,7 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
> >       /* Update the L3 QoS table*/
> >       for (i = 0; i < num_qos; i++) {
> >               cos = get_cos_entry(cos_table[i]);
> > -             if (cos != NULL) {
> > +             if (cos) {
> >                       if (ODP_COS_MAX_L3_QOS > qos_table[i])
> >                               l3_cos->cos[qos_table[i]] = cos;
> >               }
> > @@ -449,7 +449,7 @@ int odp_pmr_destroy(odp_pmr_t pmr_id)
> >  {
> >       pmr_t *pmr = get_pmr_entry(pmr_id);
> >
> > -     if (pmr == NULL)
> > +     if (!pmr)
> >               return -1;
> >       pmr->s.valid = 0;
> >       return 0;
> > @@ -465,19 +465,19 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
> >       cos_t *cos;
> >
> >       pktio_entry = get_pktio_entry(src_pktio);
> > -     if (pktio_entry == NULL) {
> > +     if (!pktio_entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> >
> >       pmr = get_pmr_entry(pmr_id);
> > -     if (pmr == NULL) {
> > +     if (!pmr) {
> >               ODP_ERR("Invalid odp_pmr_t handle");
> >               return -1;
> >       }
> >
> >       cos = get_cos_entry(dst_cos);
> > -     if (cos == NULL) {
> > +     if (!cos) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -585,7 +585,7 @@ int odp_pmr_match_set_destroy(odp_pmr_set_t
> pmr_set_id)
> >  {
> >       pmr_set_t *pmr_set = get_pmr_set_entry(pmr_set_id);
> >
> > -     if (pmr_set == NULL)
> > +     if (!pmr_set)
> >               return -1;
> >
> >       pmr_set->s.pmr.s.valid = 0;
> > @@ -601,19 +601,19 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t
> pmr_set_id, odp_pktio_t src_pktio,
> >       cos_t *cos;
> >
> >       pktio_entry = get_pktio_entry(src_pktio);
> > -     if (pktio_entry == NULL) {
> > +     if (!pktio_entry) {
> >               ODP_ERR("Invalid odp_pktio_t handle");
> >               return -1;
> >       }
> >
> >       pmr = (pmr_t *)get_pmr_set_entry(pmr_set_id);
> > -     if (pmr == NULL) {
> > +     if (!pmr) {
> >               ODP_ERR("Invalid odp_pmr_set_t handle");
> >               return -1;
> >       }
> >
> >       cos = get_cos_entry(dst_cos);
> > -     if (cos == NULL) {
> > +     if (!cos) {
> >               ODP_ERR("Invalid odp_cos_t handle");
> >               return -1;
> >       }
> > @@ -750,7 +750,7 @@ cos_t *match_pmr_cos(cos_t *cos, uint8_t *pkt_addr,
> pmr_t *pmr,
> >  {
> >       cos_t *retcos = NULL;
> >
> > -     if (cos == NULL || pmr == NULL)
> > +     if (!cos || !pmr)
> >               return NULL;
> >
> >       if (!cos->s.valid)
> > @@ -773,7 +773,7 @@ int pktio_classifier_init(pktio_entry_t *entry)
> >       int i;
> >
> >       /* classifier lock should be acquired by the calling function */
> > -     if (entry == NULL)
> > +     if (!entry)
> >               return -1;
> >       cls = &entry->s.cls;
> >       cls->num_pmr = 0;
> > @@ -800,7 +800,7 @@ int packet_classifier(odp_pktio_t pktio,
> odp_packet_t pkt)
> >       uint8_t *pkt_addr;
> >
> >       entry = get_pktio_entry(pktio);
> > -     if (entry == NULL)
> > +     if (!entry)
> >               return -1;
> >
> >       pkt_hdr = odp_packet_hdr(pkt);
> > @@ -808,7 +808,7 @@ int packet_classifier(odp_pktio_t pktio,
> odp_packet_t pkt)
> >
> >       /* Matching PMR and selecting the CoS for the packet*/
> >       cos = pktio_select_cos(entry, pkt_addr, pkt_hdr);
> > -     if (cos == NULL)
> > +     if (!cos)
> >               return -1;
> >
> >       /* Enqueuing the Packet based on the CoS */
> > diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> > index 9384291..f073aa8 100644
> > --- a/platform/linux-generic/odp_crypto.c
> > +++ b/platform/linux-generic/odp_crypto.c
> > @@ -452,7 +452,7 @@ int odp_crypto_term_global(void)
> >       int count = 0;
> >       odp_crypto_generic_session_t *session;
> >
> > -     for (session = global->free; session != NULL; session =
> session->next)
> > +     for (session = global->free; session; session = session->next)
> >               count++;
> >       if (count != MAX_SESSIONS) {
> >               ODP_ERR("crypto sessions still active\n");
> > diff --git a/platform/linux-generic/odp_errno.c
> b/platform/linux-generic/odp_errno.c
> > index 1a76d43..5d2f0ea 100644
> > --- a/platform/linux-generic/odp_errno.c
> > +++ b/platform/linux-generic/odp_errno.c
> > @@ -24,7 +24,7 @@ void odp_errno_zero(void)
> >
> >  void odp_errno_print(const char *str)
> >  {
> > -     if (str != NULL)
> > +     if (str)
> >               printf("%s ", str);
> >
> >       ODP_PRINT("%s\n", strerror(__odp_errno));
> > diff --git a/platform/linux-generic/odp_init.c
> b/platform/linux-generic/odp_init.c
> > index 2bfabb6..6b4497c 100644
> > --- a/platform/linux-generic/odp_init.c
> > +++ b/platform/linux-generic/odp_init.c
> > @@ -17,10 +17,10 @@ int odp_init_global(odp_init_t *params,
> >       odp_global_data.log_fn = odp_override_log;
> >       odp_global_data.abort_fn = odp_override_abort;
> >
> > -     if (params != NULL) {
> > -             if (params->log_fn != NULL)
> > +     if (params) {
> > +             if (params->log_fn)
> >                       odp_global_data.log_fn = params->log_fn;
> > -             if (params->abort_fn != NULL)
> > +             if (params->abort_fn)
> >                       odp_global_data.abort_fn = params->abort_fn;
> >       }
> >
> > diff --git a/platform/linux-generic/odp_packet.c
> b/platform/linux-generic/odp_packet.c
> > index bdd84a8..fc848f9 100644
> > --- a/platform/linux-generic/odp_packet.c
> > +++ b/platform/linux-generic/odp_packet.c
> > @@ -193,7 +193,7 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t
> offset, uint32_t *len,
> >       odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
> >       void *addr = packet_map(pkt_hdr, offset, len);
> >
> > -     if (addr != NULL && seg != NULL) {
> > +     if (addr && seg) {
> >               odp_buffer_bits_t seghandle;
> >
> >               seghandle.handle = (odp_buffer_t)pkt;
> > @@ -440,8 +440,8 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt,
> uint32_t offset,
> >
> >                       new_hdr->input = pkt_hdr->input;
> >                       new_hdr->buf_hdr.buf_u64 =
> pkt_hdr->buf_hdr.buf_u64;
> > -                     if (new_hdr->buf_hdr.uarea_addr != NULL &&
> > -                         pkt_hdr->buf_hdr.uarea_addr != NULL)
> > +                     if (new_hdr->buf_hdr.uarea_addr &&
> > +                         pkt_hdr->buf_hdr.uarea_addr)
> >                               memcpy(new_hdr->buf_hdr.uarea_addr,
> >                                      pkt_hdr->buf_hdr.uarea_addr,
> >                                      new_hdr->buf_hdr.uarea_size <=
> > @@ -485,8 +485,8 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt,
> uint32_t offset,
> >
> >                       new_hdr->input = pkt_hdr->input;
> >                       new_hdr->buf_hdr.buf_u64 =
> pkt_hdr->buf_hdr.buf_u64;
> > -                     if (new_hdr->buf_hdr.uarea_addr != NULL &&
> > -                         pkt_hdr->buf_hdr.uarea_addr != NULL)
> > +                     if (new_hdr->buf_hdr.uarea_addr &&
> > +                         pkt_hdr->buf_hdr.uarea_addr)
> >                               memcpy(new_hdr->buf_hdr.uarea_addr,
> >                                      pkt_hdr->buf_hdr.uarea_addr,
> >                                      new_hdr->buf_hdr.uarea_size <=
> > @@ -630,7 +630,7 @@ int odp_packet_is_valid(odp_packet_t pkt)
> >  {
> >       odp_buffer_hdr_t *buf = validate_buf((odp_buffer_t)pkt);
> >
> > -     return (buf != NULL && buf->type == ODP_EVENT_PACKET);
> > +     return (buf && buf->type == ODP_EVENT_PACKET);
> >  }
> >
> >  /*
> > @@ -647,8 +647,8 @@ void _odp_packet_copy_md_to_packet(odp_packet_t
> srcpkt, odp_packet_t dstpkt)
> >
> >       dsthdr->input = srchdr->input;
> >       dsthdr->buf_hdr.buf_u64 = srchdr->buf_hdr.buf_u64;
> > -     if (dsthdr->buf_hdr.uarea_addr != NULL &&
> > -         srchdr->buf_hdr.uarea_addr != NULL)
> > +     if (dsthdr->buf_hdr.uarea_addr &&
> > +         srchdr->buf_hdr.uarea_addr)
> >               memcpy(dsthdr->buf_hdr.uarea_addr,
> >                      srchdr->buf_hdr.uarea_addr,
> >                      dsthdr->buf_hdr.uarea_size <=
> > diff --git a/platform/linux-generic/odp_packet_io.c
> b/platform/linux-generic/odp_packet_io.c
> > index 2c7240e..1a8d3fb 100644
> > --- a/platform/linux-generic/odp_packet_io.c
> > +++ b/platform/linux-generic/odp_packet_io.c
> > @@ -44,7 +44,7 @@ int odp_pktio_init_global(void)
> >                             sizeof(pktio_entry_t), 0);
> >       pktio_tbl = odp_shm_addr(shm);
> >
> > -     if (pktio_tbl == NULL)
> > +     if (!pktio_tbl)
> >               return -1;
> >
> >       memset(pktio_tbl, 0, sizeof(pktio_table_t));
> > @@ -188,7 +188,7 @@ static int free_pktio_entry(odp_pktio_t id)
> >  {
> >       pktio_entry_t *entry = get_pktio_entry(id);
> >
> > -     if (entry == NULL)
> > +     if (!entry)
> >               return -1;
> >
> >       set_free(entry);
> > @@ -269,7 +269,7 @@ int odp_pktio_close(odp_pktio_t id)
> >       int res = -1;
> >
> >       entry = get_pktio_entry(id);
> > -     if (entry == NULL)
> > +     if (!entry)
> >               return -1;
> >
> >       lock_entry(entry);
> > @@ -321,7 +321,7 @@ int odp_pktio_recv(odp_pktio_t id, odp_packet_t
> pkt_table[], int len)
> >       int pkts;
> >       int i;
> >
> > -     if (pktio_entry == NULL)
> > +     if (!pktio_entry)
> >               return -1;
> >
> >       lock_entry(pktio_entry);
> > @@ -342,7 +342,7 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t
> pkt_table[], int len)
> >       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >       int pkts;
> >
> > -     if (pktio_entry == NULL)
> > +     if (!pktio_entry)
> >               return -1;
> >
> >       lock_entry(pktio_entry);
> > @@ -357,7 +357,7 @@ int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t
> queue)
> >       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >       queue_entry_t *qentry;
> >
> > -     if (pktio_entry == NULL || queue == ODP_QUEUE_INVALID)
> > +     if (!pktio_entry || queue == ODP_QUEUE_INVALID)
> >               return -1;
> >
> >       qentry = queue_to_qentry(queue);
> > @@ -400,7 +400,7 @@ int odp_pktio_inq_remdef(odp_pktio_t id)
> >       odp_queue_t queue;
> >       queue_entry_t *qentry;
> >
> > -     if (pktio_entry == NULL)
> > +     if (!pktio_entry)
> >               return -1;
> >
> >       lock_entry(pktio_entry);
> > @@ -421,7 +421,7 @@ odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)
> >  {
> >       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >
> > -     if (pktio_entry == NULL)
> > +     if (!pktio_entry)
> >               return ODP_QUEUE_INVALID;
> >
> >       return pktio_entry->s.inq_default;
> > @@ -431,7 +431,7 @@ odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id)
> >  {
> >       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >
> > -     if (pktio_entry == NULL)
> > +     if (!pktio_entry)
> >               return ODP_QUEUE_INVALID;
> >
> >       return pktio_entry->s.outq_default;
> > @@ -491,7 +491,7 @@ odp_buffer_hdr_t *pktin_dequeue(queue_entry_t
> *qentry)
> >       int pkts, i, j;
> >
> >       buf_hdr = queue_deq(qentry);
> > -     if (buf_hdr != NULL)
> > +     if (buf_hdr)
> >               return buf_hdr;
> >
> >       pkts = odp_pktio_recv(qentry->s.pktin, pkt_tbl, QUEUE_MULTI_MAX);
> > @@ -608,7 +608,7 @@ int odp_pktio_mtu(odp_pktio_t id)
> >       int ret;
> >
> >       entry = get_pktio_entry(id);
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_DBG("pktio entry %d does not exist\n", id);
> >               return -1;
> >       }
> > @@ -632,7 +632,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id,
> odp_bool_t enable)
> >       int ret;
> >
> >       entry = get_pktio_entry(id);
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_DBG("pktio entry %d does not exist\n", id);
> >               return -1;
> >       }
> > @@ -657,7 +657,7 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
> >       int ret;
> >
> >       entry = get_pktio_entry(id);
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_DBG("pktio entry %d does not exist\n", id);
> >               return -1;
> >       }
> > @@ -687,7 +687,7 @@ int odp_pktio_mac_addr(odp_pktio_t id, void
> *mac_addr, int addr_size)
> >       }
> >
> >       entry = get_pktio_entry(id);
> > -     if (entry == NULL) {
> > +     if (!entry) {
> >               ODP_DBG("pktio entry %d does not exist\n", id);
> >               return -1;
> >       }
> > diff --git a/platform/linux-generic/odp_pool.c
> b/platform/linux-generic/odp_pool.c
> > index 79100a1..dc12887 100644
> > --- a/platform/linux-generic/odp_pool.c
> > +++ b/platform/linux-generic/odp_pool.c
> > @@ -66,7 +66,7 @@ int odp_pool_init_global(void)
> >
> >       pool_tbl = odp_shm_addr(shm);
> >
> > -     if (pool_tbl == NULL)
> > +     if (!pool_tbl)
> >               return -1;
> >
> >       memset(pool_tbl, 0, sizeof(pool_table_t));
> > @@ -147,7 +147,7 @@ odp_pool_t odp_pool_create(const char *name,
> odp_pool_param_t *params)
> >       uint32_t i, headroom = 0, tailroom = 0;
> >       odp_shm_t shm;
> >
> > -     if (params == NULL)
> > +     if (!params)
> >               return ODP_POOL_INVALID;
> >
> >       /* Default size and align for timeouts */
> > @@ -253,7 +253,7 @@ odp_pool_t odp_pool_create(const char *name,
> odp_pool_param_t *params)
> >
> >               pool->s.flags.all = 0;
> >
> > -             if (name == NULL) {
> > +             if (!name) {
> >                       pool->s.name[0] = 0;
> >               } else {
> >                       strncpy(pool->s.name, name, ODP_POOL_NAME_LEN -
> 1);
> > @@ -423,7 +423,7 @@ int odp_pool_info(odp_pool_t pool_hdl,
> odp_pool_info_t *info)
> >       uint32_t pool_id = pool_handle_to_index(pool_hdl);
> >       pool_entry_t *pool = get_pool_entry(pool_id);
> >
> > -     if (pool == NULL || info == NULL)
> > +     if (!pool || !info)
> >               return -1;
> >
> >       info->name = pool->s.name;
> > @@ -437,7 +437,7 @@ int odp_pool_destroy(odp_pool_t pool_hdl)
> >       uint32_t pool_id = pool_handle_to_index(pool_hdl);
> >       pool_entry_t *pool = get_pool_entry(pool_id);
> >
> > -     if (pool == NULL)
> > +     if (!pool)
> >               return -1;
> >
> >       POOL_LOCK(&pool->s.lock);
> > @@ -482,10 +482,10 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl,
> size_t size)
> >                                                   &pool->s, totsize);
> >
> >       /* If cache is empty, satisfy request from the pool */
> > -     if (odp_unlikely(buf == NULL)) {
> > +     if (odp_unlikely(!buf)) {
> >               buf = (odp_anybuf_t *)(void *)get_buf(&pool->s);
> >
> > -             if (odp_unlikely(buf == NULL))
> > +             if (odp_unlikely(!buf))
> >                       return ODP_BUFFER_INVALID;
> >
> >               /* Get blocks for this buffer, if pool uses application
> data */
> > @@ -495,7 +495,7 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl,
> size_t size)
> >                       do {
> >                               uint8_t *blk = get_blk(&pool->s);
> >
> > -                             if (blk == NULL) {
> > +                             if (!blk) {
> >                                       ret_buf(&pool->s, &buf->buf);
> >                                       return ODP_BUFFER_INVALID;
> >                               }
> > diff --git a/platform/linux-generic/odp_queue.c
> b/platform/linux-generic/odp_queue.c
> > index 2cbcac2..01b39c5 100644
> > --- a/platform/linux-generic/odp_queue.c
> > +++ b/platform/linux-generic/odp_queue.c
> > @@ -103,7 +103,7 @@ int odp_queue_init_global(void)
> >
> >       queue_tbl = odp_shm_addr(shm);
> >
> > -     if (queue_tbl == NULL)
> > +     if (!queue_tbl)
> >               return -1;
> >
> >       memset(queue_tbl, 0, sizeof(queue_table_t));
> > @@ -257,7 +257,7 @@ int odp_queue_destroy(odp_queue_t handle)
> >               ODP_ERR("queue \"%s\" already destroyed\n", queue->s.name
> );
> >               return -1;
> >       }
> > -     if (queue->s.head != NULL) {
> > +     if (queue->s.head) {
> >               UNLOCK(&queue->s.lock);
> >               ODP_ERR("queue \"%s\" not empty\n", queue->s.name);
> >               return -1;
> > @@ -335,7 +335,7 @@ int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t
> *buf_hdr)
> >               return -1;
> >       }
> >
> > -     if (queue->s.head == NULL) {
> > +     if (!queue->s.head) {
> >               /* Empty queue */
> >               queue->s.head = buf_hdr;
> >               queue->s.tail = buf_hdr;
> > @@ -379,7 +379,7 @@ int queue_enq_multi(queue_entry_t *queue,
> odp_buffer_hdr_t *buf_hdr[], int num)
> >       }
> >
> >       /* Empty queue */
> > -     if (queue->s.head == NULL)
> > +     if (!queue->s.head)
> >               queue->s.head = buf_hdr[0];
> >       else
> >               queue->s.tail->next = buf_hdr[0];
> > @@ -433,7 +433,7 @@ odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
> >
> >       LOCK(&queue->s.lock);
> >
> > -     if (queue->s.head == NULL) {
> > +     if (!queue->s.head) {
> >               /* Already empty queue */
> >               if (queue->s.status == QUEUE_STATUS_SCHED)
> >                       queue->s.status = QUEUE_STATUS_NOTSCHED;
> > @@ -446,7 +446,7 @@ odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
> >       queue->s.head = buf_hdr->next;
> >       buf_hdr->next = NULL;
> >
> > -     if (queue->s.head == NULL) {
> > +     if (!queue->s.head) {
> >               /* Queue is now empty */
> >               queue->s.tail = NULL;
> >       }
> > @@ -471,7 +471,7 @@ int queue_deq_multi(queue_entry_t *queue,
> odp_buffer_hdr_t *buf_hdr[], int num)
> >
> >       hdr = queue->s.head;
> >
> > -     if (hdr == NULL) {
> > +     if (!hdr) {
> >               /* Already empty queue */
> >               if (queue->s.status == QUEUE_STATUS_SCHED)
> >                       queue->s.status = QUEUE_STATUS_NOTSCHED;
> > @@ -488,7 +488,7 @@ int queue_deq_multi(queue_entry_t *queue,
> odp_buffer_hdr_t *buf_hdr[], int num)
> >
> >       queue->s.head = hdr;
> >
> > -     if (hdr == NULL) {
> > +     if (!hdr) {
> >               /* Queue is now empty */
> >               queue->s.tail = NULL;
> >       }
> > diff --git a/platform/linux-generic/odp_schedule.c
> b/platform/linux-generic/odp_schedule.c
> > index 172d0a0..fc5677c 100644
> > --- a/platform/linux-generic/odp_schedule.c
> > +++ b/platform/linux-generic/odp_schedule.c
> > @@ -112,7 +112,7 @@ int odp_schedule_init_global(void)
> >
> >       sched = odp_shm_addr(shm);
> >
> > -     if (sched == NULL) {
> > +     if (!sched) {
> >               ODP_ERR("Schedule init: Shm reserve failed.\n");
> >               return -1;
> >       }
> > diff --git a/platform/linux-generic/odp_shared_memory.c
> b/platform/linux-generic/odp_shared_memory.c
> > index 38b0b28..5935e0a 100644
> > --- a/platform/linux-generic/odp_shared_memory.c
> > +++ b/platform/linux-generic/odp_shared_memory.c
> > @@ -113,7 +113,7 @@ static int find_block(const char *name, uint32_t
> *index)
> >       for (i = 0; i < ODP_CONFIG_SHM_BLOCKS; i++) {
> >               if (strcmp(name, odp_shm_tbl->block[i].name) == 0) {
> >                       /* found it */
> > -                     if (index != NULL)
> > +                     if (index)
> >                               *index = i;
> >
> >                       return 1;
> > @@ -145,7 +145,7 @@ int odp_shm_free(odp_shm_t shm)
> >
> >       block = &odp_shm_tbl->block[i];
> >
> > -     if (block->addr == NULL) {
> > +     if (!block->addr) {
> >               ODP_DBG("odp_shm_free: Free block\n");
> >               odp_spinlock_unlock(&odp_shm_tbl->lock);
> >               return 0;
> > @@ -221,7 +221,7 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t
> size, uint64_t align,
> >       }
> >
> >       for (i = 0; i < ODP_CONFIG_SHM_BLOCKS; i++) {
> > -             if (odp_shm_tbl->block[i].addr == NULL) {
> > +             if (!odp_shm_tbl->block[i].addr) {
> >                       /* Found free block */
> >                       break;
> >               }
> > diff --git a/platform/linux-generic/odp_system_info.c
> b/platform/linux-generic/odp_system_info.c
> > index 8897832..9e217ff 100644
> > --- a/platform/linux-generic/odp_system_info.c
> > +++ b/platform/linux-generic/odp_system_info.c
> > @@ -61,12 +61,12 @@ static int systemcpu_cache_line_size(void)
> >       int size = 0;
> >
> >       file = fopen(CACHE_LNSZ_FILE, "rt");
> > -     if (file == NULL) {
> > +     if (!file) {
> >               /* File not found */
> >               return 0;
> >       }
> >
> > -     if (fgets(str, sizeof(str), file) != NULL) {
> > +     if (fgets(str, sizeof(str), file)) {
> >               /* Read cache line size */
> >               if (!sscanf(str, "%i", &size) == EOF) {
> >                       ODP_ERR("failed to read chche line size\n");
> > @@ -87,7 +87,7 @@ static int huge_page_size(void)
> >       int size = 0;
> >
> >       dir = opendir(HUGE_PAGE_DIR);
> > -     if (dir == NULL) {
> > +     if (!dir) {
> >               ODP_ERR("%s not found\n", HUGE_PAGE_DIR);
> >               return 0;
> >       }
> > @@ -122,7 +122,7 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t
> *sysinfo)
> >       int model = 0;
> >       int count = 2;
> >
> > -     while (fgets(str, sizeof(str), file) != NULL && count > 0) {
> > +     while (fgets(str, sizeof(str), file) && count > 0) {
> >               if (!mhz) {
> >                       pos = strstr(str, "cpu MHz");
> >                       if (pos) {
> > @@ -170,7 +170,7 @@ static int cpuinfo_octeon(FILE *file,
> odp_system_info_t *sysinfo)
> >       int model = 0;
> >       int count = 2;
> >
> > -     while (fgets(str, sizeof(str), file) != NULL && count > 0) {
> > +     while (fgets(str, sizeof(str), file) && count > 0) {
> >               if (!mhz) {
> >                       pos = strstr(str, "BogoMIPS");
> >
> > @@ -211,7 +211,7 @@ static int cpuinfo_powerpc(FILE *file,
> odp_system_info_t *sysinfo)
> >       int model = 0;
> >       int count = 2;
> >
> > -     while (fgets(str, sizeof(str), file) != NULL && count > 0) {
> > +     while (fgets(str, sizeof(str), file) && count > 0) {
> >               if (!mhz) {
> >                       pos = strstr(str, "clock");
> >
> > @@ -344,7 +344,7 @@ int odp_system_info_init(void)
> >       odp_global_data.system_info.page_size = ODP_PAGE_SIZE;
> >
> >       file = fopen("/proc/cpuinfo", "rt");
> > -     if (file == NULL) {
> > +     if (!file) {
> >               ODP_ERR("Failed to open /proc/cpuinfo\n");
> >               return -1;
> >       }
> > diff --git a/platform/linux-generic/odp_thread.c
> b/platform/linux-generic/odp_thread.c
> > index 13c5ff2..c1e71e4 100644
> > --- a/platform/linux-generic/odp_thread.c
> > +++ b/platform/linux-generic/odp_thread.c
> > @@ -55,7 +55,7 @@ int odp_thread_init_global(void)
> >
> >       thread_globals = odp_shm_addr(shm);
> >
> > -     if (thread_globals == NULL)
> > +     if (!thread_globals)
> >               return -1;
> >
> >       memset(thread_globals, 0, sizeof(thread_globals_t));
> > diff --git a/platform/linux-generic/odp_timer.c
> b/platform/linux-generic/odp_timer.c
> > index 45074cc..e90bbed 100644
> > --- a/platform/linux-generic/odp_timer.c
> > +++ b/platform/linux-generic/odp_timer.c
> > @@ -357,7 +357,7 @@ static bool timer_reset(uint32_t idx,
> >       bool success = true;
> >       tick_buf_t *tb = &tp->tick_buf[idx];
> >
> > -     if (tmo_buf == NULL || *tmo_buf == ODP_BUFFER_INVALID) {
> > +     if (!tmo_buf || *tmo_buf == ODP_BUFFER_INVALID) {
> >  #ifdef ODP_ATOMIC_U128
> >               tick_buf_t new, old;
> >
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Aug. 26, 2015, 4:02 p.m. UTC | #2
Hi Nicolas

I found the difference to be that NULL == cos is missed by checkpatch and  cos
== NULL is found see
<http://lxr.free-electrons.com/source/scripts/checkpatch.pl#L4751> the regex

So checkpatch does not flag the cases you found which I assume is a bug in
checkpatch version 0.32 we have which is also in 4.1 need to check if the
Kernel guys want this behavior.

If appropriate let me send my fix for checkpatch upstream and maybe we can
pick it up in ODP 1.4, but for now, this does pass our rules :)

I can use it find the missing cases you identified as a test for my fix.

Mike

On 26 August 2015 at 03:01, Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
wrote:

> Even in linux generic I can see some differencres with my patch Like these
> lines that should faild your odp check:
> platform/linux-generic/odp_classification.c:257:        if (NULL == cos) {
> platform/linux-generic/odp_classification.c:507:        if (NULL ==
> cos_src || NULL == cos_dst || NULL == pmr) {
>
>
> On 08/25/2015 06:47 PM, Mike Holmes wrote:
> > I did not consciously leave anything, I focused on linux-generic and just
> > tried to fix what I saw by repeatedly running the following and grouping
> > the fixes in to the patches.
> >
> > find platform/linux-genric -name *.h -o -name *.c -exec
> ./scripts/odp_check
> > {} \;
> >
> > I expect the same is needed for test and examples, that may be the
> > difference ?
> >
> >
> > On 25 August 2015 at 12:17, Nicolas Morey-Chaisemartin <nmorey@kalray.eu
> >
> > wrote:
> >
> >> I tried to check your patch against the large one I proposed before and
> >> see many differences.
> >> Did you willingly leave some of these behind? Or did you use a regexp
> >> which missed some?
> >>
> >> Nicolas
> >>
> >> On 08/25/2015 05:26 PM, Mike Holmes wrote:
> >>> Checkpatch requires that:
> >>> (entry == NULL) be written (!entry)
> >>> (entry != NULL) be written (entry)
> >>>
> >>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> >>> ---
> >>>  platform/linux-generic/odp_classification.c | 54
> >> ++++++++++++++---------------
> >>>  platform/linux-generic/odp_crypto.c         |  2 +-
> >>>  platform/linux-generic/odp_errno.c          |  2 +-
> >>>  platform/linux-generic/odp_init.c           |  6 ++--
> >>>  platform/linux-generic/odp_packet.c         | 16 ++++-----
> >>>  platform/linux-generic/odp_packet_io.c      | 28 +++++++--------
> >>>  platform/linux-generic/odp_pool.c           | 16 ++++-----
> >>>  platform/linux-generic/odp_queue.c          | 16 ++++-----
> >>>  platform/linux-generic/odp_schedule.c       |  2 +-
> >>>  platform/linux-generic/odp_shared_memory.c  |  6 ++--
> >>>  platform/linux-generic/odp_system_info.c    | 14 ++++----
> >>>  platform/linux-generic/odp_thread.c         |  2 +-
> >>>  platform/linux-generic/odp_timer.c          |  2 +-
> >>>  13 files changed, 83 insertions(+), 83 deletions(-)
> >>>
> >>> diff --git a/platform/linux-generic/odp_classification.c
> >> b/platform/linux-generic/odp_classification.c
> >>> index 452631a..66e2049 100644
> >>> --- a/platform/linux-generic/odp_classification.c
> >>> +++ b/platform/linux-generic/odp_classification.c
> >>> @@ -62,7 +62,7 @@ int odp_classification_init_global(void)
> >>>       }
> >>>
> >>>       cos_tbl = odp_shm_addr(cos_shm);
> >>> -     if (cos_tbl == NULL)
> >>> +     if (!cos_tbl)
> >>>               goto error_cos;
> >>>
> >>>       memset(cos_tbl, 0, sizeof(cos_tbl_t));
> >>> @@ -83,7 +83,7 @@ int odp_classification_init_global(void)
> >>>       }
> >>>
> >>>       pmr_tbl = odp_shm_addr(pmr_shm);
> >>> -     if (pmr_tbl == NULL)
> >>> +     if (!pmr_tbl)
> >>>               goto error_pmr;
> >>>
> >>>       memset(pmr_tbl, 0, sizeof(pmr_tbl_t));
> >>> @@ -104,7 +104,7 @@ int odp_classification_init_global(void)
> >>>       }
> >>>
> >>>       pmr_set_tbl = odp_shm_addr(pmr_set_shm);
> >>> -     if (pmr_set_tbl == NULL)
> >>> +     if (!pmr_set_tbl)
> >>>               goto error_pmrset;
> >>>
> >>>       memset(pmr_set_tbl, 0, sizeof(pmr_set_tbl_t));
> >>> @@ -267,7 +267,7 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t
> >> queue_id)
> >>>  {
> >>>       cos_t *cos = get_cos_entry(cos_id);
> >>>
> >>> -     if (cos == NULL) {
> >>> +     if (!cos) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -281,7 +281,7 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e
> >> drop_policy)
> >>>  {
> >>>       cos_t *cos = get_cos_entry(cos_id);
> >>>
> >>> -     if (cos == NULL) {
> >>> +     if (!cos) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -297,12 +297,12 @@ int odp_pktio_default_cos_set(odp_pktio_t
> >> pktio_in, odp_cos_t default_cos)
> >>>       cos_t *cos;
> >>>
> >>>       entry = get_pktio_entry(pktio_in);
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>>       cos = get_cos_entry(default_cos);
> >>> -     if (cos == NULL) {
> >>> +     if (!cos) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -317,13 +317,13 @@ int odp_pktio_error_cos_set(odp_pktio_t pktio_in,
> >> odp_cos_t error_cos)
> >>>       cos_t *cos;
> >>>
> >>>       entry = get_pktio_entry(pktio_in);
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>>
> >>>       cos = get_cos_entry(error_cos);
> >>> -     if (cos == NULL) {
> >>> +     if (!cos) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -336,7 +336,7 @@ int odp_pktio_skip_set(odp_pktio_t pktio_in,
> >> uint32_t offset)
> >>>  {
> >>>       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >>>
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -349,7 +349,7 @@ int odp_pktio_headroom_set(odp_pktio_t pktio_in,
> >> uint32_t headroom)
> >>>  {
> >>>       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >>>
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -367,7 +367,7 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
> >>>       cos_t *cos;
> >>>       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >>>
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -377,7 +377,7 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
> >>>       /* Update the L2 QoS table*/
> >>>       for (i = 0; i < num_qos; i++) {
> >>>               cos = get_cos_entry(cos_table[i]);
> >>> -             if (cos != NULL) {
> >>> +             if (cos) {
> >>>                       if (ODP_COS_MAX_L2_QOS > qos_table[i])
> >>>                               l2_cos->cos[qos_table[i]] = cos;
> >>>               }
> >>> @@ -397,7 +397,7 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
> >>>       pktio_entry_t *entry = get_pktio_entry(pktio_in);
> >>>       cos_t *cos;
> >>>
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -409,7 +409,7 @@ int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
> >>>       /* Update the L3 QoS table*/
> >>>       for (i = 0; i < num_qos; i++) {
> >>>               cos = get_cos_entry(cos_table[i]);
> >>> -             if (cos != NULL) {
> >>> +             if (cos) {
> >>>                       if (ODP_COS_MAX_L3_QOS > qos_table[i])
> >>>                               l3_cos->cos[qos_table[i]] = cos;
> >>>               }
> >>> @@ -449,7 +449,7 @@ int odp_pmr_destroy(odp_pmr_t pmr_id)
> >>>  {
> >>>       pmr_t *pmr = get_pmr_entry(pmr_id);
> >>>
> >>> -     if (pmr == NULL)
> >>> +     if (!pmr)
> >>>               return -1;
> >>>       pmr->s.valid = 0;
> >>>       return 0;
> >>> @@ -465,19 +465,19 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
> >>>       cos_t *cos;
> >>>
> >>>       pktio_entry = get_pktio_entry(src_pktio);
> >>> -     if (pktio_entry == NULL) {
> >>> +     if (!pktio_entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>>
> >>>       pmr = get_pmr_entry(pmr_id);
> >>> -     if (pmr == NULL) {
> >>> +     if (!pmr) {
> >>>               ODP_ERR("Invalid odp_pmr_t handle");
> >>>               return -1;
> >>>       }
> >>>
> >>>       cos = get_cos_entry(dst_cos);
> >>> -     if (cos == NULL) {
> >>> +     if (!cos) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -585,7 +585,7 @@ int odp_pmr_match_set_destroy(odp_pmr_set_t
> >> pmr_set_id)
> >>>  {
> >>>       pmr_set_t *pmr_set = get_pmr_set_entry(pmr_set_id);
> >>>
> >>> -     if (pmr_set == NULL)
> >>> +     if (!pmr_set)
> >>>               return -1;
> >>>
> >>>       pmr_set->s.pmr.s.valid = 0;
> >>> @@ -601,19 +601,19 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t
> >> pmr_set_id, odp_pktio_t src_pktio,
> >>>       cos_t *cos;
> >>>
> >>>       pktio_entry = get_pktio_entry(src_pktio);
> >>> -     if (pktio_entry == NULL) {
> >>> +     if (!pktio_entry) {
> >>>               ODP_ERR("Invalid odp_pktio_t handle");
> >>>               return -1;
> >>>       }
> >>>
> >>>       pmr = (pmr_t *)get_pmr_set_entry(pmr_set_id);
> >>> -     if (pmr == NULL) {
> >>> +     if (!pmr) {
> >>>               ODP_ERR("Invalid odp_pmr_set_t handle");
> >>>               return -1;
> >>>       }
> >>>
> >>>       cos = get_cos_entry(dst_cos);
> >>> -     if (cos == NULL) {
> >>> +     if (!cos) {
> >>>               ODP_ERR("Invalid odp_cos_t handle");
> >>>               return -1;
> >>>       }
> >>> @@ -750,7 +750,7 @@ cos_t *match_pmr_cos(cos_t *cos, uint8_t *pkt_addr,
> >> pmr_t *pmr,
> >>>  {
> >>>       cos_t *retcos = NULL;
> >>>
> >>> -     if (cos == NULL || pmr == NULL)
> >>> +     if (!cos || !pmr)
> >>>               return NULL;
> >>>
> >>>       if (!cos->s.valid)
> >>> @@ -773,7 +773,7 @@ int pktio_classifier_init(pktio_entry_t *entry)
> >>>       int i;
> >>>
> >>>       /* classifier lock should be acquired by the calling function */
> >>> -     if (entry == NULL)
> >>> +     if (!entry)
> >>>               return -1;
> >>>       cls = &entry->s.cls;
> >>>       cls->num_pmr = 0;
> >>> @@ -800,7 +800,7 @@ int packet_classifier(odp_pktio_t pktio,
> >> odp_packet_t pkt)
> >>>       uint8_t *pkt_addr;
> >>>
> >>>       entry = get_pktio_entry(pktio);
> >>> -     if (entry == NULL)
> >>> +     if (!entry)
> >>>               return -1;
> >>>
> >>>       pkt_hdr = odp_packet_hdr(pkt);
> >>> @@ -808,7 +808,7 @@ int packet_classifier(odp_pktio_t pktio,
> >> odp_packet_t pkt)
> >>>       /* Matching PMR and selecting the CoS for the packet*/
> >>>       cos = pktio_select_cos(entry, pkt_addr, pkt_hdr);
> >>> -     if (cos == NULL)
> >>> +     if (!cos)
> >>>               return -1;
> >>>
> >>>       /* Enqueuing the Packet based on the CoS */
> >>> diff --git a/platform/linux-generic/odp_crypto.c
> >> b/platform/linux-generic/odp_crypto.c
> >>> index 9384291..f073aa8 100644
> >>> --- a/platform/linux-generic/odp_crypto.c
> >>> +++ b/platform/linux-generic/odp_crypto.c
> >>> @@ -452,7 +452,7 @@ int odp_crypto_term_global(void)
> >>>       int count = 0;
> >>>       odp_crypto_generic_session_t *session;
> >>>
> >>> -     for (session = global->free; session != NULL; session =
> >> session->next)
> >>> +     for (session = global->free; session; session = session->next)
> >>>               count++;
> >>>       if (count != MAX_SESSIONS) {
> >>>               ODP_ERR("crypto sessions still active\n");
> >>> diff --git a/platform/linux-generic/odp_errno.c
> >> b/platform/linux-generic/odp_errno.c
> >>> index 1a76d43..5d2f0ea 100644
> >>> --- a/platform/linux-generic/odp_errno.c
> >>> +++ b/platform/linux-generic/odp_errno.c
> >>> @@ -24,7 +24,7 @@ void odp_errno_zero(void)
> >>>
> >>>  void odp_errno_print(const char *str)
> >>>  {
> >>> -     if (str != NULL)
> >>> +     if (str)
> >>>               printf("%s ", str);
> >>>
> >>>       ODP_PRINT("%s\n", strerror(__odp_errno));
> >>> diff --git a/platform/linux-generic/odp_init.c
> >> b/platform/linux-generic/odp_init.c
> >>> index 2bfabb6..6b4497c 100644
> >>> --- a/platform/linux-generic/odp_init.c
> >>> +++ b/platform/linux-generic/odp_init.c
> >>> @@ -17,10 +17,10 @@ int odp_init_global(odp_init_t *params,
> >>>       odp_global_data.log_fn = odp_override_log;
> >>>       odp_global_data.abort_fn = odp_override_abort;
> >>>
> >>> -     if (params != NULL) {
> >>> -             if (params->log_fn != NULL)
> >>> +     if (params) {
> >>> +             if (params->log_fn)
> >>>                       odp_global_data.log_fn = params->log_fn;
> >>> -             if (params->abort_fn != NULL)
> >>> +             if (params->abort_fn)
> >>>                       odp_global_data.abort_fn = params->abort_fn;
> >>>       }
> >>>
> >>> diff --git a/platform/linux-generic/odp_packet.c
> >> b/platform/linux-generic/odp_packet.c
> >>> index bdd84a8..fc848f9 100644
> >>> --- a/platform/linux-generic/odp_packet.c
> >>> +++ b/platform/linux-generic/odp_packet.c
> >>> @@ -193,7 +193,7 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t
> >> offset, uint32_t *len,
> >>>       odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
> >>>       void *addr = packet_map(pkt_hdr, offset, len);
> >>>
> >>> -     if (addr != NULL && seg != NULL) {
> >>> +     if (addr && seg) {
> >>>               odp_buffer_bits_t seghandle;
> >>>
> >>>               seghandle.handle = (odp_buffer_t)pkt;
> >>> @@ -440,8 +440,8 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt,
> >> uint32_t offset,
> >>>                       new_hdr->input = pkt_hdr->input;
> >>>                       new_hdr->buf_hdr.buf_u64 =
> >> pkt_hdr->buf_hdr.buf_u64;
> >>> -                     if (new_hdr->buf_hdr.uarea_addr != NULL &&
> >>> -                         pkt_hdr->buf_hdr.uarea_addr != NULL)
> >>> +                     if (new_hdr->buf_hdr.uarea_addr &&
> >>> +                         pkt_hdr->buf_hdr.uarea_addr)
> >>>                               memcpy(new_hdr->buf_hdr.uarea_addr,
> >>>                                      pkt_hdr->buf_hdr.uarea_addr,
> >>>                                      new_hdr->buf_hdr.uarea_size <=
> >>> @@ -485,8 +485,8 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt,
> >> uint32_t offset,
> >>>                       new_hdr->input = pkt_hdr->input;
> >>>                       new_hdr->buf_hdr.buf_u64 =
> >> pkt_hdr->buf_hdr.buf_u64;
> >>> -                     if (new_hdr->buf_hdr.uarea_addr != NULL &&
> >>> -                         pkt_hdr->buf_hdr.uarea_addr != NULL)
> >>> +                     if (new_hdr->buf_hdr.uarea_addr &&
> >>> +                         pkt_hdr->buf_hdr.uarea_addr)
> >>>                               memcpy(new_hdr->buf_hdr.uarea_addr,
> >>>                                      pkt_hdr->buf_hdr.uarea_addr,
> >>>                                      new_hdr->buf_hdr.uarea_size <=
> >>> @@ -630,7 +630,7 @@ int odp_packet_is_valid(odp_packet_t pkt)
> >>>  {
> >>>       odp_buffer_hdr_t *buf = validate_buf((odp_buffer_t)pkt);
> >>>
> >>> -     return (buf != NULL && buf->type == ODP_EVENT_PACKET);
> >>> +     return (buf && buf->type == ODP_EVENT_PACKET);
> >>>  }
> >>>
> >>>  /*
> >>> @@ -647,8 +647,8 @@ void _odp_packet_copy_md_to_packet(odp_packet_t
> >> srcpkt, odp_packet_t dstpkt)
> >>>       dsthdr->input = srchdr->input;
> >>>       dsthdr->buf_hdr.buf_u64 = srchdr->buf_hdr.buf_u64;
> >>> -     if (dsthdr->buf_hdr.uarea_addr != NULL &&
> >>> -         srchdr->buf_hdr.uarea_addr != NULL)
> >>> +     if (dsthdr->buf_hdr.uarea_addr &&
> >>> +         srchdr->buf_hdr.uarea_addr)
> >>>               memcpy(dsthdr->buf_hdr.uarea_addr,
> >>>                      srchdr->buf_hdr.uarea_addr,
> >>>                      dsthdr->buf_hdr.uarea_size <=
> >>> diff --git a/platform/linux-generic/odp_packet_io.c
> >> b/platform/linux-generic/odp_packet_io.c
> >>> index 2c7240e..1a8d3fb 100644
> >>> --- a/platform/linux-generic/odp_packet_io.c
> >>> +++ b/platform/linux-generic/odp_packet_io.c
> >>> @@ -44,7 +44,7 @@ int odp_pktio_init_global(void)
> >>>                             sizeof(pktio_entry_t), 0);
> >>>       pktio_tbl = odp_shm_addr(shm);
> >>>
> >>> -     if (pktio_tbl == NULL)
> >>> +     if (!pktio_tbl)
> >>>               return -1;
> >>>
> >>>       memset(pktio_tbl, 0, sizeof(pktio_table_t));
> >>> @@ -188,7 +188,7 @@ static int free_pktio_entry(odp_pktio_t id)
> >>>  {
> >>>       pktio_entry_t *entry = get_pktio_entry(id);
> >>>
> >>> -     if (entry == NULL)
> >>> +     if (!entry)
> >>>               return -1;
> >>>
> >>>       set_free(entry);
> >>> @@ -269,7 +269,7 @@ int odp_pktio_close(odp_pktio_t id)
> >>>       int res = -1;
> >>>
> >>>       entry = get_pktio_entry(id);
> >>> -     if (entry == NULL)
> >>> +     if (!entry)
> >>>               return -1;
> >>>
> >>>       lock_entry(entry);
> >>> @@ -321,7 +321,7 @@ int odp_pktio_recv(odp_pktio_t id, odp_packet_t
> >> pkt_table[], int len)
> >>>       int pkts;
> >>>       int i;
> >>>
> >>> -     if (pktio_entry == NULL)
> >>> +     if (!pktio_entry)
> >>>               return -1;
> >>>
> >>>       lock_entry(pktio_entry);
> >>> @@ -342,7 +342,7 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t
> >> pkt_table[], int len)
> >>>       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >>>       int pkts;
> >>>
> >>> -     if (pktio_entry == NULL)
> >>> +     if (!pktio_entry)
> >>>               return -1;
> >>>
> >>>       lock_entry(pktio_entry);
> >>> @@ -357,7 +357,7 @@ int odp_pktio_inq_setdef(odp_pktio_t id,
> odp_queue_t
> >> queue)
> >>>       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >>>       queue_entry_t *qentry;
> >>>
> >>> -     if (pktio_entry == NULL || queue == ODP_QUEUE_INVALID)
> >>> +     if (!pktio_entry || queue == ODP_QUEUE_INVALID)
> >>>               return -1;
> >>>
> >>>       qentry = queue_to_qentry(queue);
> >>> @@ -400,7 +400,7 @@ int odp_pktio_inq_remdef(odp_pktio_t id)
> >>>       odp_queue_t queue;
> >>>       queue_entry_t *qentry;
> >>>
> >>> -     if (pktio_entry == NULL)
> >>> +     if (!pktio_entry)
> >>>               return -1;
> >>>
> >>>       lock_entry(pktio_entry);
> >>> @@ -421,7 +421,7 @@ odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)
> >>>  {
> >>>       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >>>
> >>> -     if (pktio_entry == NULL)
> >>> +     if (!pktio_entry)
> >>>               return ODP_QUEUE_INVALID;
> >>>
> >>>       return pktio_entry->s.inq_default;
> >>> @@ -431,7 +431,7 @@ odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id)
> >>>  {
> >>>       pktio_entry_t *pktio_entry = get_pktio_entry(id);
> >>>
> >>> -     if (pktio_entry == NULL)
> >>> +     if (!pktio_entry)
> >>>               return ODP_QUEUE_INVALID;
> >>>
> >>>       return pktio_entry->s.outq_default;
> >>> @@ -491,7 +491,7 @@ odp_buffer_hdr_t *pktin_dequeue(queue_entry_t
> >> *qentry)
> >>>       int pkts, i, j;
> >>>
> >>>       buf_hdr = queue_deq(qentry);
> >>> -     if (buf_hdr != NULL)
> >>> +     if (buf_hdr)
> >>>               return buf_hdr;
> >>>
> >>>       pkts = odp_pktio_recv(qentry->s.pktin, pkt_tbl, QUEUE_MULTI_MAX);
> >>> @@ -608,7 +608,7 @@ int odp_pktio_mtu(odp_pktio_t id)
> >>>       int ret;
> >>>
> >>>       entry = get_pktio_entry(id);
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_DBG("pktio entry %d does not exist\n", id);
> >>>               return -1;
> >>>       }
> >>> @@ -632,7 +632,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id,
> >> odp_bool_t enable)
> >>>       int ret;
> >>>
> >>>       entry = get_pktio_entry(id);
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_DBG("pktio entry %d does not exist\n", id);
> >>>               return -1;
> >>>       }
> >>> @@ -657,7 +657,7 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
> >>>       int ret;
> >>>
> >>>       entry = get_pktio_entry(id);
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_DBG("pktio entry %d does not exist\n", id);
> >>>               return -1;
> >>>       }
> >>> @@ -687,7 +687,7 @@ int odp_pktio_mac_addr(odp_pktio_t id, void
> >> *mac_addr, int addr_size)
> >>>       }
> >>>
> >>>       entry = get_pktio_entry(id);
> >>> -     if (entry == NULL) {
> >>> +     if (!entry) {
> >>>               ODP_DBG("pktio entry %d does not exist\n", id);
> >>>               return -1;
> >>>       }
> >>> diff --git a/platform/linux-generic/odp_pool.c
> >> b/platform/linux-generic/odp_pool.c
> >>> index 79100a1..dc12887 100644
> >>> --- a/platform/linux-generic/odp_pool.c
> >>> +++ b/platform/linux-generic/odp_pool.c
> >>> @@ -66,7 +66,7 @@ int odp_pool_init_global(void)
> >>>
> >>>       pool_tbl = odp_shm_addr(shm);
> >>>
> >>> -     if (pool_tbl == NULL)
> >>> +     if (!pool_tbl)
> >>>               return -1;
> >>>
> >>>       memset(pool_tbl, 0, sizeof(pool_table_t));
> >>> @@ -147,7 +147,7 @@ odp_pool_t odp_pool_create(const char *name,
> >> odp_pool_param_t *params)
> >>>       uint32_t i, headroom = 0, tailroom = 0;
> >>>       odp_shm_t shm;
> >>>
> >>> -     if (params == NULL)
> >>> +     if (!params)
> >>>               return ODP_POOL_INVALID;
> >>>
> >>>       /* Default size and align for timeouts */
> >>> @@ -253,7 +253,7 @@ odp_pool_t odp_pool_create(const char *name,
> >> odp_pool_param_t *params)
> >>>               pool->s.flags.all = 0;
> >>>
> >>> -             if (name == NULL) {
> >>> +             if (!name) {
> >>>                       pool->s.name[0] = 0;
> >>>               } else {
> >>>                       strncpy(pool->s.name, name, ODP_POOL_NAME_LEN -
> >> 1);
> >>> @@ -423,7 +423,7 @@ int odp_pool_info(odp_pool_t pool_hdl,
> >> odp_pool_info_t *info)
> >>>       uint32_t pool_id = pool_handle_to_index(pool_hdl);
> >>>       pool_entry_t *pool = get_pool_entry(pool_id);
> >>>
> >>> -     if (pool == NULL || info == NULL)
> >>> +     if (!pool || !info)
> >>>               return -1;
> >>>
> >>>       info->name = pool->s.name;
> >>> @@ -437,7 +437,7 @@ int odp_pool_destroy(odp_pool_t pool_hdl)
> >>>       uint32_t pool_id = pool_handle_to_index(pool_hdl);
> >>>       pool_entry_t *pool = get_pool_entry(pool_id);
> >>>
> >>> -     if (pool == NULL)
> >>> +     if (!pool)
> >>>               return -1;
> >>>
> >>>       POOL_LOCK(&pool->s.lock);
> >>> @@ -482,10 +482,10 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl,
> >> size_t size)
> >>>                                                   &pool->s, totsize);
> >>>
> >>>       /* If cache is empty, satisfy request from the pool */
> >>> -     if (odp_unlikely(buf == NULL)) {
> >>> +     if (odp_unlikely(!buf)) {
> >>>               buf = (odp_anybuf_t *)(void *)get_buf(&pool->s);
> >>>
> >>> -             if (odp_unlikely(buf == NULL))
> >>> +             if (odp_unlikely(!buf))
> >>>                       return ODP_BUFFER_INVALID;
> >>>
> >>>               /* Get blocks for this buffer, if pool uses application
> >> data */
> >>> @@ -495,7 +495,7 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl,
> >> size_t size)
> >>>                       do {
> >>>                               uint8_t *blk = get_blk(&pool->s);
> >>>
> >>> -                             if (blk == NULL) {
> >>> +                             if (!blk) {
> >>>                                       ret_buf(&pool->s, &buf->buf);
> >>>                                       return ODP_BUFFER_INVALID;
> >>>                               }
> >>> diff --git a/platform/linux-generic/odp_queue.c
> >> b/platform/linux-generic/odp_queue.c
> >>> index 2cbcac2..01b39c5 100644
> >>> --- a/platform/linux-generic/odp_queue.c
> >>> +++ b/platform/linux-generic/odp_queue.c
> >>> @@ -103,7 +103,7 @@ int odp_queue_init_global(void)
> >>>
> >>>       queue_tbl = odp_shm_addr(shm);
> >>>
> >>> -     if (queue_tbl == NULL)
> >>> +     if (!queue_tbl)
> >>>               return -1;
> >>>
> >>>       memset(queue_tbl, 0, sizeof(queue_table_t));
> >>> @@ -257,7 +257,7 @@ int odp_queue_destroy(odp_queue_t handle)
> >>>               ODP_ERR("queue \"%s\" already destroyed\n", queue->
> s.name
> >> );
> >>>               return -1;
> >>>       }
> >>> -     if (queue->s.head != NULL) {
> >>> +     if (queue->s.head) {
> >>>               UNLOCK(&queue->s.lock);
> >>>               ODP_ERR("queue \"%s\" not empty\n", queue->s.name);
> >>>               return -1;
> >>> @@ -335,7 +335,7 @@ int queue_enq(queue_entry_t *queue,
> odp_buffer_hdr_t
> >> *buf_hdr)
> >>>               return -1;
> >>>       }
> >>>
> >>> -     if (queue->s.head == NULL) {
> >>> +     if (!queue->s.head) {
> >>>               /* Empty queue */
> >>>               queue->s.head = buf_hdr;
> >>>               queue->s.tail = buf_hdr;
> >>> @@ -379,7 +379,7 @@ int queue_enq_multi(queue_entry_t *queue,
> >> odp_buffer_hdr_t *buf_hdr[], int num)
> >>>       }
> >>>
> >>>       /* Empty queue */
> >>> -     if (queue->s.head == NULL)
> >>> +     if (!queue->s.head)
> >>>               queue->s.head = buf_hdr[0];
> >>>       else
> >>>               queue->s.tail->next = buf_hdr[0];
> >>> @@ -433,7 +433,7 @@ odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
> >>>
> >>>       LOCK(&queue->s.lock);
> >>>
> >>> -     if (queue->s.head == NULL) {
> >>> +     if (!queue->s.head) {
> >>>               /* Already empty queue */
> >>>               if (queue->s.status == QUEUE_STATUS_SCHED)
> >>>                       queue->s.status = QUEUE_STATUS_NOTSCHED;
> >>> @@ -446,7 +446,7 @@ odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
> >>>       queue->s.head = buf_hdr->next;
> >>>       buf_hdr->next = NULL;
> >>>
> >>> -     if (queue->s.head == NULL) {
> >>> +     if (!queue->s.head) {
> >>>               /* Queue is now empty */
> >>>               queue->s.tail = NULL;
> >>>       }
> >>> @@ -471,7 +471,7 @@ int queue_deq_multi(queue_entry_t *queue,
> >> odp_buffer_hdr_t *buf_hdr[], int num)
> >>>       hdr = queue->s.head;
> >>>
> >>> -     if (hdr == NULL) {
> >>> +     if (!hdr) {
> >>>               /* Already empty queue */
> >>>               if (queue->s.status == QUEUE_STATUS_SCHED)
> >>>                       queue->s.status = QUEUE_STATUS_NOTSCHED;
> >>> @@ -488,7 +488,7 @@ int queue_deq_multi(queue_entry_t *queue,
> >> odp_buffer_hdr_t *buf_hdr[], int num)
> >>>       queue->s.head = hdr;
> >>>
> >>> -     if (hdr == NULL) {
> >>> +     if (!hdr) {
> >>>               /* Queue is now empty */
> >>>               queue->s.tail = NULL;
> >>>       }
> >>> diff --git a/platform/linux-generic/odp_schedule.c
> >> b/platform/linux-generic/odp_schedule.c
> >>> index 172d0a0..fc5677c 100644
> >>> --- a/platform/linux-generic/odp_schedule.c
> >>> +++ b/platform/linux-generic/odp_schedule.c
> >>> @@ -112,7 +112,7 @@ int odp_schedule_init_global(void)
> >>>
> >>>       sched = odp_shm_addr(shm);
> >>>
> >>> -     if (sched == NULL) {
> >>> +     if (!sched) {
> >>>               ODP_ERR("Schedule init: Shm reserve failed.\n");
> >>>               return -1;
> >>>       }
> >>> diff --git a/platform/linux-generic/odp_shared_memory.c
> >> b/platform/linux-generic/odp_shared_memory.c
> >>> index 38b0b28..5935e0a 100644
> >>> --- a/platform/linux-generic/odp_shared_memory.c
> >>> +++ b/platform/linux-generic/odp_shared_memory.c
> >>> @@ -113,7 +113,7 @@ static int find_block(const char *name, uint32_t
> >> *index)
> >>>       for (i = 0; i < ODP_CONFIG_SHM_BLOCKS; i++) {
> >>>               if (strcmp(name, odp_shm_tbl->block[i].name) == 0) {
> >>>                       /* found it */
> >>> -                     if (index != NULL)
> >>> +                     if (index)
> >>>                               *index = i;
> >>>
> >>>                       return 1;
> >>> @@ -145,7 +145,7 @@ int odp_shm_free(odp_shm_t shm)
> >>>
> >>>       block = &odp_shm_tbl->block[i];
> >>>
> >>> -     if (block->addr == NULL) {
> >>> +     if (!block->addr) {
> >>>               ODP_DBG("odp_shm_free: Free block\n");
> >>>               odp_spinlock_unlock(&odp_shm_tbl->lock);
> >>>               return 0;
> >>> @@ -221,7 +221,7 @@ odp_shm_t odp_shm_reserve(const char *name,
> uint64_t
> >> size, uint64_t align,
> >>>       }
> >>>
> >>>       for (i = 0; i < ODP_CONFIG_SHM_BLOCKS; i++) {
> >>> -             if (odp_shm_tbl->block[i].addr == NULL) {
> >>> +             if (!odp_shm_tbl->block[i].addr) {
> >>>                       /* Found free block */
> >>>                       break;
> >>>               }
> >>> diff --git a/platform/linux-generic/odp_system_info.c
> >> b/platform/linux-generic/odp_system_info.c
> >>> index 8897832..9e217ff 100644
> >>> --- a/platform/linux-generic/odp_system_info.c
> >>> +++ b/platform/linux-generic/odp_system_info.c
> >>> @@ -61,12 +61,12 @@ static int systemcpu_cache_line_size(void)
> >>>       int size = 0;
> >>>
> >>>       file = fopen(CACHE_LNSZ_FILE, "rt");
> >>> -     if (file == NULL) {
> >>> +     if (!file) {
> >>>               /* File not found */
> >>>               return 0;
> >>>       }
> >>>
> >>> -     if (fgets(str, sizeof(str), file) != NULL) {
> >>> +     if (fgets(str, sizeof(str), file)) {
> >>>               /* Read cache line size */
> >>>               if (!sscanf(str, "%i", &size) == EOF) {
> >>>                       ODP_ERR("failed to read chche line size\n");
> >>> @@ -87,7 +87,7 @@ static int huge_page_size(void)
> >>>       int size = 0;
> >>>
> >>>       dir = opendir(HUGE_PAGE_DIR);
> >>> -     if (dir == NULL) {
> >>> +     if (!dir) {
> >>>               ODP_ERR("%s not found\n", HUGE_PAGE_DIR);
> >>>               return 0;
> >>>       }
> >>> @@ -122,7 +122,7 @@ static int cpuinfo_x86(FILE *file,
> odp_system_info_t
> >> *sysinfo)
> >>>       int model = 0;
> >>>       int count = 2;
> >>>
> >>> -     while (fgets(str, sizeof(str), file) != NULL && count > 0) {
> >>> +     while (fgets(str, sizeof(str), file) && count > 0) {
> >>>               if (!mhz) {
> >>>                       pos = strstr(str, "cpu MHz");
> >>>                       if (pos) {
> >>> @@ -170,7 +170,7 @@ static int cpuinfo_octeon(FILE *file,
> >> odp_system_info_t *sysinfo)
> >>>       int model = 0;
> >>>       int count = 2;
> >>>
> >>> -     while (fgets(str, sizeof(str), file) != NULL && count > 0) {
> >>> +     while (fgets(str, sizeof(str), file) && count > 0) {
> >>>               if (!mhz) {
> >>>                       pos = strstr(str, "BogoMIPS");
> >>>
> >>> @@ -211,7 +211,7 @@ static int cpuinfo_powerpc(FILE *file,
> >> odp_system_info_t *sysinfo)
> >>>       int model = 0;
> >>>       int count = 2;
> >>>
> >>> -     while (fgets(str, sizeof(str), file) != NULL && count > 0) {
> >>> +     while (fgets(str, sizeof(str), file) && count > 0) {
> >>>               if (!mhz) {
> >>>                       pos = strstr(str, "clock");
> >>>
> >>> @@ -344,7 +344,7 @@ int odp_system_info_init(void)
> >>>       odp_global_data.system_info.page_size = ODP_PAGE_SIZE;
> >>>
> >>>       file = fopen("/proc/cpuinfo", "rt");
> >>> -     if (file == NULL) {
> >>> +     if (!file) {
> >>>               ODP_ERR("Failed to open /proc/cpuinfo\n");
> >>>               return -1;
> >>>       }
> >>> diff --git a/platform/linux-generic/odp_thread.c
> >> b/platform/linux-generic/odp_thread.c
> >>> index 13c5ff2..c1e71e4 100644
> >>> --- a/platform/linux-generic/odp_thread.c
> >>> +++ b/platform/linux-generic/odp_thread.c
> >>> @@ -55,7 +55,7 @@ int odp_thread_init_global(void)
> >>>
> >>>       thread_globals = odp_shm_addr(shm);
> >>>
> >>> -     if (thread_globals == NULL)
> >>> +     if (!thread_globals)
> >>>               return -1;
> >>>
> >>>       memset(thread_globals, 0, sizeof(thread_globals_t));
> >>> diff --git a/platform/linux-generic/odp_timer.c
> >> b/platform/linux-generic/odp_timer.c
> >>> index 45074cc..e90bbed 100644
> >>> --- a/platform/linux-generic/odp_timer.c
> >>> +++ b/platform/linux-generic/odp_timer.c
> >>> @@ -357,7 +357,7 @@ static bool timer_reset(uint32_t idx,
> >>>       bool success = true;
> >>>       tick_buf_t *tb = &tp->tick_buf[idx];
> >>>
> >>> -     if (tmo_buf == NULL || *tmo_buf == ODP_BUFFER_INVALID) {
> >>> +     if (!tmo_buf || *tmo_buf == ODP_BUFFER_INVALID) {
> >>>  #ifdef ODP_ATOMIC_U128
> >>>               tick_buf_t new, old;
> >>>
> >> _______________________________________________
> >> lng-odp mailing list
> >> lng-odp@lists.linaro.org
> >> https://lists.linaro.org/mailman/listinfo/lng-odp
> >>
> >
> >
>
>
diff mbox

Patch

diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 452631a..66e2049 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -62,7 +62,7 @@  int odp_classification_init_global(void)
 	}
 
 	cos_tbl = odp_shm_addr(cos_shm);
-	if (cos_tbl == NULL)
+	if (!cos_tbl)
 		goto error_cos;
 
 	memset(cos_tbl, 0, sizeof(cos_tbl_t));
@@ -83,7 +83,7 @@  int odp_classification_init_global(void)
 	}
 
 	pmr_tbl = odp_shm_addr(pmr_shm);
-	if (pmr_tbl == NULL)
+	if (!pmr_tbl)
 		goto error_pmr;
 
 	memset(pmr_tbl, 0, sizeof(pmr_tbl_t));
@@ -104,7 +104,7 @@  int odp_classification_init_global(void)
 	}
 
 	pmr_set_tbl = odp_shm_addr(pmr_set_shm);
-	if (pmr_set_tbl == NULL)
+	if (!pmr_set_tbl)
 		goto error_pmrset;
 
 	memset(pmr_set_tbl, 0, sizeof(pmr_set_tbl_t));
@@ -267,7 +267,7 @@  int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id)
 {
 	cos_t *cos = get_cos_entry(cos_id);
 
-	if (cos == NULL) {
+	if (!cos) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -281,7 +281,7 @@  int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy)
 {
 	cos_t *cos = get_cos_entry(cos_id);
 
-	if (cos == NULL) {
+	if (!cos) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -297,12 +297,12 @@  int odp_pktio_default_cos_set(odp_pktio_t pktio_in, odp_cos_t default_cos)
 	cos_t *cos;
 
 	entry = get_pktio_entry(pktio_in);
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
 	cos = get_cos_entry(default_cos);
-	if (cos == NULL) {
+	if (!cos) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -317,13 +317,13 @@  int odp_pktio_error_cos_set(odp_pktio_t pktio_in, odp_cos_t error_cos)
 	cos_t *cos;
 
 	entry = get_pktio_entry(pktio_in);
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
 
 	cos = get_cos_entry(error_cos);
-	if (cos == NULL) {
+	if (!cos) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -336,7 +336,7 @@  int odp_pktio_skip_set(odp_pktio_t pktio_in, uint32_t offset)
 {
 	pktio_entry_t *entry = get_pktio_entry(pktio_in);
 
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -349,7 +349,7 @@  int odp_pktio_headroom_set(odp_pktio_t pktio_in, uint32_t headroom)
 {
 	pktio_entry_t *entry = get_pktio_entry(pktio_in);
 
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
@@ -367,7 +367,7 @@  int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
 	cos_t *cos;
 	pktio_entry_t *entry = get_pktio_entry(pktio_in);
 
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
@@ -377,7 +377,7 @@  int odp_cos_with_l2_priority(odp_pktio_t pktio_in,
 	/* Update the L2 QoS table*/
 	for (i = 0; i < num_qos; i++) {
 		cos = get_cos_entry(cos_table[i]);
-		if (cos != NULL) {
+		if (cos) {
 			if (ODP_COS_MAX_L2_QOS > qos_table[i])
 				l2_cos->cos[qos_table[i]] = cos;
 		}
@@ -397,7 +397,7 @@  int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
 	pktio_entry_t *entry = get_pktio_entry(pktio_in);
 	cos_t *cos;
 
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
@@ -409,7 +409,7 @@  int odp_cos_with_l3_qos(odp_pktio_t pktio_in,
 	/* Update the L3 QoS table*/
 	for (i = 0; i < num_qos; i++) {
 		cos = get_cos_entry(cos_table[i]);
-		if (cos != NULL) {
+		if (cos) {
 			if (ODP_COS_MAX_L3_QOS > qos_table[i])
 				l3_cos->cos[qos_table[i]] = cos;
 		}
@@ -449,7 +449,7 @@  int odp_pmr_destroy(odp_pmr_t pmr_id)
 {
 	pmr_t *pmr = get_pmr_entry(pmr_id);
 
-	if (pmr == NULL)
+	if (!pmr)
 		return -1;
 	pmr->s.valid = 0;
 	return 0;
@@ -465,19 +465,19 @@  int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
 	cos_t *cos;
 
 	pktio_entry = get_pktio_entry(src_pktio);
-	if (pktio_entry == NULL) {
+	if (!pktio_entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
 
 	pmr = get_pmr_entry(pmr_id);
-	if (pmr == NULL) {
+	if (!pmr) {
 		ODP_ERR("Invalid odp_pmr_t handle");
 		return -1;
 	}
 
 	cos = get_cos_entry(dst_cos);
-	if (cos == NULL) {
+	if (!cos) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -585,7 +585,7 @@  int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id)
 {
 	pmr_set_t *pmr_set = get_pmr_set_entry(pmr_set_id);
 
-	if (pmr_set == NULL)
+	if (!pmr_set)
 		return -1;
 
 	pmr_set->s.pmr.s.valid = 0;
@@ -601,19 +601,19 @@  int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t src_pktio,
 	cos_t *cos;
 
 	pktio_entry = get_pktio_entry(src_pktio);
-	if (pktio_entry == NULL) {
+	if (!pktio_entry) {
 		ODP_ERR("Invalid odp_pktio_t handle");
 		return -1;
 	}
 
 	pmr = (pmr_t *)get_pmr_set_entry(pmr_set_id);
-	if (pmr == NULL) {
+	if (!pmr) {
 		ODP_ERR("Invalid odp_pmr_set_t handle");
 		return -1;
 	}
 
 	cos = get_cos_entry(dst_cos);
-	if (cos == NULL) {
+	if (!cos) {
 		ODP_ERR("Invalid odp_cos_t handle");
 		return -1;
 	}
@@ -750,7 +750,7 @@  cos_t *match_pmr_cos(cos_t *cos, uint8_t *pkt_addr, pmr_t *pmr,
 {
 	cos_t *retcos = NULL;
 
-	if (cos == NULL || pmr == NULL)
+	if (!cos || !pmr)
 		return NULL;
 
 	if (!cos->s.valid)
@@ -773,7 +773,7 @@  int pktio_classifier_init(pktio_entry_t *entry)
 	int i;
 
 	/* classifier lock should be acquired by the calling function */
-	if (entry == NULL)
+	if (!entry)
 		return -1;
 	cls = &entry->s.cls;
 	cls->num_pmr = 0;
@@ -800,7 +800,7 @@  int packet_classifier(odp_pktio_t pktio, odp_packet_t pkt)
 	uint8_t *pkt_addr;
 
 	entry = get_pktio_entry(pktio);
-	if (entry == NULL)
+	if (!entry)
 		return -1;
 
 	pkt_hdr = odp_packet_hdr(pkt);
@@ -808,7 +808,7 @@  int packet_classifier(odp_pktio_t pktio, odp_packet_t pkt)
 
 	/* Matching PMR and selecting the CoS for the packet*/
 	cos = pktio_select_cos(entry, pkt_addr, pkt_hdr);
-	if (cos == NULL)
+	if (!cos)
 		return -1;
 
 	/* Enqueuing the Packet based on the CoS */
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 9384291..f073aa8 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -452,7 +452,7 @@  int odp_crypto_term_global(void)
 	int count = 0;
 	odp_crypto_generic_session_t *session;
 
-	for (session = global->free; session != NULL; session = session->next)
+	for (session = global->free; session; session = session->next)
 		count++;
 	if (count != MAX_SESSIONS) {
 		ODP_ERR("crypto sessions still active\n");
diff --git a/platform/linux-generic/odp_errno.c b/platform/linux-generic/odp_errno.c
index 1a76d43..5d2f0ea 100644
--- a/platform/linux-generic/odp_errno.c
+++ b/platform/linux-generic/odp_errno.c
@@ -24,7 +24,7 @@  void odp_errno_zero(void)
 
 void odp_errno_print(const char *str)
 {
-	if (str != NULL)
+	if (str)
 		printf("%s ", str);
 
 	ODP_PRINT("%s\n", strerror(__odp_errno));
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 2bfabb6..6b4497c 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -17,10 +17,10 @@  int odp_init_global(odp_init_t *params,
 	odp_global_data.log_fn = odp_override_log;
 	odp_global_data.abort_fn = odp_override_abort;
 
-	if (params != NULL) {
-		if (params->log_fn != NULL)
+	if (params) {
+		if (params->log_fn)
 			odp_global_data.log_fn = params->log_fn;
-		if (params->abort_fn != NULL)
+		if (params->abort_fn)
 			odp_global_data.abort_fn = params->abort_fn;
 	}
 
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index bdd84a8..fc848f9 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -193,7 +193,7 @@  void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len,
 	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
 	void *addr = packet_map(pkt_hdr, offset, len);
 
-	if (addr != NULL && seg != NULL) {
+	if (addr && seg) {
 		odp_buffer_bits_t seghandle;
 
 		seghandle.handle = (odp_buffer_t)pkt;
@@ -440,8 +440,8 @@  odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset,
 
 			new_hdr->input = pkt_hdr->input;
 			new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
-			if (new_hdr->buf_hdr.uarea_addr != NULL &&
-			    pkt_hdr->buf_hdr.uarea_addr != NULL)
+			if (new_hdr->buf_hdr.uarea_addr &&
+			    pkt_hdr->buf_hdr.uarea_addr)
 				memcpy(new_hdr->buf_hdr.uarea_addr,
 				       pkt_hdr->buf_hdr.uarea_addr,
 				       new_hdr->buf_hdr.uarea_size <=
@@ -485,8 +485,8 @@  odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
 
 			new_hdr->input = pkt_hdr->input;
 			new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
-			if (new_hdr->buf_hdr.uarea_addr != NULL &&
-			    pkt_hdr->buf_hdr.uarea_addr != NULL)
+			if (new_hdr->buf_hdr.uarea_addr &&
+			    pkt_hdr->buf_hdr.uarea_addr)
 				memcpy(new_hdr->buf_hdr.uarea_addr,
 				       pkt_hdr->buf_hdr.uarea_addr,
 				       new_hdr->buf_hdr.uarea_size <=
@@ -630,7 +630,7 @@  int odp_packet_is_valid(odp_packet_t pkt)
 {
 	odp_buffer_hdr_t *buf = validate_buf((odp_buffer_t)pkt);
 
-	return (buf != NULL && buf->type == ODP_EVENT_PACKET);
+	return (buf && buf->type == ODP_EVENT_PACKET);
 }
 
 /*
@@ -647,8 +647,8 @@  void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt)
 
 	dsthdr->input = srchdr->input;
 	dsthdr->buf_hdr.buf_u64 = srchdr->buf_hdr.buf_u64;
-	if (dsthdr->buf_hdr.uarea_addr != NULL &&
-	    srchdr->buf_hdr.uarea_addr != NULL)
+	if (dsthdr->buf_hdr.uarea_addr &&
+	    srchdr->buf_hdr.uarea_addr)
 		memcpy(dsthdr->buf_hdr.uarea_addr,
 		       srchdr->buf_hdr.uarea_addr,
 		       dsthdr->buf_hdr.uarea_size <=
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 2c7240e..1a8d3fb 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -44,7 +44,7 @@  int odp_pktio_init_global(void)
 			      sizeof(pktio_entry_t), 0);
 	pktio_tbl = odp_shm_addr(shm);
 
-	if (pktio_tbl == NULL)
+	if (!pktio_tbl)
 		return -1;
 
 	memset(pktio_tbl, 0, sizeof(pktio_table_t));
@@ -188,7 +188,7 @@  static int free_pktio_entry(odp_pktio_t id)
 {
 	pktio_entry_t *entry = get_pktio_entry(id);
 
-	if (entry == NULL)
+	if (!entry)
 		return -1;
 
 	set_free(entry);
@@ -269,7 +269,7 @@  int odp_pktio_close(odp_pktio_t id)
 	int res = -1;
 
 	entry = get_pktio_entry(id);
-	if (entry == NULL)
+	if (!entry)
 		return -1;
 
 	lock_entry(entry);
@@ -321,7 +321,7 @@  int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], int len)
 	int pkts;
 	int i;
 
-	if (pktio_entry == NULL)
+	if (!pktio_entry)
 		return -1;
 
 	lock_entry(pktio_entry);
@@ -342,7 +342,7 @@  int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], int len)
 	pktio_entry_t *pktio_entry = get_pktio_entry(id);
 	int pkts;
 
-	if (pktio_entry == NULL)
+	if (!pktio_entry)
 		return -1;
 
 	lock_entry(pktio_entry);
@@ -357,7 +357,7 @@  int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue)
 	pktio_entry_t *pktio_entry = get_pktio_entry(id);
 	queue_entry_t *qentry;
 
-	if (pktio_entry == NULL || queue == ODP_QUEUE_INVALID)
+	if (!pktio_entry || queue == ODP_QUEUE_INVALID)
 		return -1;
 
 	qentry = queue_to_qentry(queue);
@@ -400,7 +400,7 @@  int odp_pktio_inq_remdef(odp_pktio_t id)
 	odp_queue_t queue;
 	queue_entry_t *qentry;
 
-	if (pktio_entry == NULL)
+	if (!pktio_entry)
 		return -1;
 
 	lock_entry(pktio_entry);
@@ -421,7 +421,7 @@  odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id)
 {
 	pktio_entry_t *pktio_entry = get_pktio_entry(id);
 
-	if (pktio_entry == NULL)
+	if (!pktio_entry)
 		return ODP_QUEUE_INVALID;
 
 	return pktio_entry->s.inq_default;
@@ -431,7 +431,7 @@  odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id)
 {
 	pktio_entry_t *pktio_entry = get_pktio_entry(id);
 
-	if (pktio_entry == NULL)
+	if (!pktio_entry)
 		return ODP_QUEUE_INVALID;
 
 	return pktio_entry->s.outq_default;
@@ -491,7 +491,7 @@  odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry)
 	int pkts, i, j;
 
 	buf_hdr = queue_deq(qentry);
-	if (buf_hdr != NULL)
+	if (buf_hdr)
 		return buf_hdr;
 
 	pkts = odp_pktio_recv(qentry->s.pktin, pkt_tbl, QUEUE_MULTI_MAX);
@@ -608,7 +608,7 @@  int odp_pktio_mtu(odp_pktio_t id)
 	int ret;
 
 	entry = get_pktio_entry(id);
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_DBG("pktio entry %d does not exist\n", id);
 		return -1;
 	}
@@ -632,7 +632,7 @@  int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t enable)
 	int ret;
 
 	entry = get_pktio_entry(id);
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_DBG("pktio entry %d does not exist\n", id);
 		return -1;
 	}
@@ -657,7 +657,7 @@  int odp_pktio_promisc_mode(odp_pktio_t id)
 	int ret;
 
 	entry = get_pktio_entry(id);
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_DBG("pktio entry %d does not exist\n", id);
 		return -1;
 	}
@@ -687,7 +687,7 @@  int odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, int addr_size)
 	}
 
 	entry = get_pktio_entry(id);
-	if (entry == NULL) {
+	if (!entry) {
 		ODP_DBG("pktio entry %d does not exist\n", id);
 		return -1;
 	}
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 79100a1..dc12887 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -66,7 +66,7 @@  int odp_pool_init_global(void)
 
 	pool_tbl = odp_shm_addr(shm);
 
-	if (pool_tbl == NULL)
+	if (!pool_tbl)
 		return -1;
 
 	memset(pool_tbl, 0, sizeof(pool_table_t));
@@ -147,7 +147,7 @@  odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
 	uint32_t i, headroom = 0, tailroom = 0;
 	odp_shm_t shm;
 
-	if (params == NULL)
+	if (!params)
 		return ODP_POOL_INVALID;
 
 	/* Default size and align for timeouts */
@@ -253,7 +253,7 @@  odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
 
 		pool->s.flags.all = 0;
 
-		if (name == NULL) {
+		if (!name) {
 			pool->s.name[0] = 0;
 		} else {
 			strncpy(pool->s.name, name, ODP_POOL_NAME_LEN - 1);
@@ -423,7 +423,7 @@  int odp_pool_info(odp_pool_t pool_hdl, odp_pool_info_t *info)
 	uint32_t pool_id = pool_handle_to_index(pool_hdl);
 	pool_entry_t *pool = get_pool_entry(pool_id);
 
-	if (pool == NULL || info == NULL)
+	if (!pool || !info)
 		return -1;
 
 	info->name = pool->s.name;
@@ -437,7 +437,7 @@  int odp_pool_destroy(odp_pool_t pool_hdl)
 	uint32_t pool_id = pool_handle_to_index(pool_hdl);
 	pool_entry_t *pool = get_pool_entry(pool_id);
 
-	if (pool == NULL)
+	if (!pool)
 		return -1;
 
 	POOL_LOCK(&pool->s.lock);
@@ -482,10 +482,10 @@  odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t size)
 						    &pool->s, totsize);
 
 	/* If cache is empty, satisfy request from the pool */
-	if (odp_unlikely(buf == NULL)) {
+	if (odp_unlikely(!buf)) {
 		buf = (odp_anybuf_t *)(void *)get_buf(&pool->s);
 
-		if (odp_unlikely(buf == NULL))
+		if (odp_unlikely(!buf))
 			return ODP_BUFFER_INVALID;
 
 		/* Get blocks for this buffer, if pool uses application data */
@@ -495,7 +495,7 @@  odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t size)
 			do {
 				uint8_t *blk = get_blk(&pool->s);
 
-				if (blk == NULL) {
+				if (!blk) {
 					ret_buf(&pool->s, &buf->buf);
 					return ODP_BUFFER_INVALID;
 				}
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 2cbcac2..01b39c5 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -103,7 +103,7 @@  int odp_queue_init_global(void)
 
 	queue_tbl = odp_shm_addr(shm);
 
-	if (queue_tbl == NULL)
+	if (!queue_tbl)
 		return -1;
 
 	memset(queue_tbl, 0, sizeof(queue_table_t));
@@ -257,7 +257,7 @@  int odp_queue_destroy(odp_queue_t handle)
 		ODP_ERR("queue \"%s\" already destroyed\n", queue->s.name);
 		return -1;
 	}
-	if (queue->s.head != NULL) {
+	if (queue->s.head) {
 		UNLOCK(&queue->s.lock);
 		ODP_ERR("queue \"%s\" not empty\n", queue->s.name);
 		return -1;
@@ -335,7 +335,7 @@  int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr)
 		return -1;
 	}
 
-	if (queue->s.head == NULL) {
+	if (!queue->s.head) {
 		/* Empty queue */
 		queue->s.head = buf_hdr;
 		queue->s.tail = buf_hdr;
@@ -379,7 +379,7 @@  int queue_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num)
 	}
 
 	/* Empty queue */
-	if (queue->s.head == NULL)
+	if (!queue->s.head)
 		queue->s.head = buf_hdr[0];
 	else
 		queue->s.tail->next = buf_hdr[0];
@@ -433,7 +433,7 @@  odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
 
 	LOCK(&queue->s.lock);
 
-	if (queue->s.head == NULL) {
+	if (!queue->s.head) {
 		/* Already empty queue */
 		if (queue->s.status == QUEUE_STATUS_SCHED)
 			queue->s.status = QUEUE_STATUS_NOTSCHED;
@@ -446,7 +446,7 @@  odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
 	queue->s.head = buf_hdr->next;
 	buf_hdr->next = NULL;
 
-	if (queue->s.head == NULL) {
+	if (!queue->s.head) {
 		/* Queue is now empty */
 		queue->s.tail = NULL;
 	}
@@ -471,7 +471,7 @@  int queue_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num)
 
 	hdr = queue->s.head;
 
-	if (hdr == NULL) {
+	if (!hdr) {
 		/* Already empty queue */
 		if (queue->s.status == QUEUE_STATUS_SCHED)
 			queue->s.status = QUEUE_STATUS_NOTSCHED;
@@ -488,7 +488,7 @@  int queue_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num)
 
 	queue->s.head = hdr;
 
-	if (hdr == NULL) {
+	if (!hdr) {
 		/* Queue is now empty */
 		queue->s.tail = NULL;
 	}
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 172d0a0..fc5677c 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -112,7 +112,7 @@  int odp_schedule_init_global(void)
 
 	sched = odp_shm_addr(shm);
 
-	if (sched == NULL) {
+	if (!sched) {
 		ODP_ERR("Schedule init: Shm reserve failed.\n");
 		return -1;
 	}
diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index 38b0b28..5935e0a 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -113,7 +113,7 @@  static int find_block(const char *name, uint32_t *index)
 	for (i = 0; i < ODP_CONFIG_SHM_BLOCKS; i++) {
 		if (strcmp(name, odp_shm_tbl->block[i].name) == 0) {
 			/* found it */
-			if (index != NULL)
+			if (index)
 				*index = i;
 
 			return 1;
@@ -145,7 +145,7 @@  int odp_shm_free(odp_shm_t shm)
 
 	block = &odp_shm_tbl->block[i];
 
-	if (block->addr == NULL) {
+	if (!block->addr) {
 		ODP_DBG("odp_shm_free: Free block\n");
 		odp_spinlock_unlock(&odp_shm_tbl->lock);
 		return 0;
@@ -221,7 +221,7 @@  odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
 	}
 
 	for (i = 0; i < ODP_CONFIG_SHM_BLOCKS; i++) {
-		if (odp_shm_tbl->block[i].addr == NULL) {
+		if (!odp_shm_tbl->block[i].addr) {
 			/* Found free block */
 			break;
 		}
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 8897832..9e217ff 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -61,12 +61,12 @@  static int systemcpu_cache_line_size(void)
 	int size = 0;
 
 	file = fopen(CACHE_LNSZ_FILE, "rt");
-	if (file == NULL) {
+	if (!file) {
 		/* File not found */
 		return 0;
 	}
 
-	if (fgets(str, sizeof(str), file) != NULL) {
+	if (fgets(str, sizeof(str), file)) {
 		/* Read cache line size */
 		if (!sscanf(str, "%i", &size) == EOF) {
 			ODP_ERR("failed to read chche line size\n");
@@ -87,7 +87,7 @@  static int huge_page_size(void)
 	int size = 0;
 
 	dir = opendir(HUGE_PAGE_DIR);
-	if (dir == NULL) {
+	if (!dir) {
 		ODP_ERR("%s not found\n", HUGE_PAGE_DIR);
 		return 0;
 	}
@@ -122,7 +122,7 @@  static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
 	int model = 0;
 	int count = 2;
 
-	while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+	while (fgets(str, sizeof(str), file) && count > 0) {
 		if (!mhz) {
 			pos = strstr(str, "cpu MHz");
 			if (pos) {
@@ -170,7 +170,7 @@  static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
 	int model = 0;
 	int count = 2;
 
-	while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+	while (fgets(str, sizeof(str), file) && count > 0) {
 		if (!mhz) {
 			pos = strstr(str, "BogoMIPS");
 
@@ -211,7 +211,7 @@  static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
 	int model = 0;
 	int count = 2;
 
-	while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+	while (fgets(str, sizeof(str), file) && count > 0) {
 		if (!mhz) {
 			pos = strstr(str, "clock");
 
@@ -344,7 +344,7 @@  int odp_system_info_init(void)
 	odp_global_data.system_info.page_size = ODP_PAGE_SIZE;
 
 	file = fopen("/proc/cpuinfo", "rt");
-	if (file == NULL) {
+	if (!file) {
 		ODP_ERR("Failed to open /proc/cpuinfo\n");
 		return -1;
 	}
diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c
index 13c5ff2..c1e71e4 100644
--- a/platform/linux-generic/odp_thread.c
+++ b/platform/linux-generic/odp_thread.c
@@ -55,7 +55,7 @@  int odp_thread_init_global(void)
 
 	thread_globals = odp_shm_addr(shm);
 
-	if (thread_globals == NULL)
+	if (!thread_globals)
 		return -1;
 
 	memset(thread_globals, 0, sizeof(thread_globals_t));
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 45074cc..e90bbed 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -357,7 +357,7 @@  static bool timer_reset(uint32_t idx,
 	bool success = true;
 	tick_buf_t *tb = &tp->tick_buf[idx];
 
-	if (tmo_buf == NULL || *tmo_buf == ODP_BUFFER_INVALID) {
+	if (!tmo_buf || *tmo_buf == ODP_BUFFER_INVALID) {
 #ifdef ODP_ATOMIC_U128
 		tick_buf_t new, old;