From patchwork Wed Mar 8 13:34:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9611185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D50996046A for ; Wed, 8 Mar 2017 14:09:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1519C28543 for ; Wed, 8 Mar 2017 14:09:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 085BA2857C; Wed, 8 Mar 2017 14:09:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A094C28543 for ; Wed, 8 Mar 2017 14:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753579AbdCHOJt (ORCPT ); Wed, 8 Mar 2017 09:09:49 -0500 Received: from mout.web.de ([212.227.15.4]:50957 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752861AbdCHOJh (ORCPT ); Wed, 8 Mar 2017 09:09:37 -0500 Received: from [192.168.1.2] ([92.228.144.238]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MbMg8-1cVBJ42lN6-00IlpD; Wed, 08 Mar 2017 14:34:14 +0100 Subject: [PATCH 26/26] IB/ocrdma: Adjust further ten checks for null pointers To: linux-rdma@vger.kernel.org, Devesh Sharma , Doug Ledford , Hal Rosenstock , Sean Hefty , Selvin Xavier References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <19973137-7453-6a50-822a-c3a075e1c18f@users.sourceforge.net> Date: Wed, 8 Mar 2017 14:34:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:p/WdwdGDU4cngQmhFhj1z07mepg9pvUk5wd+utSLKfjvHUKyy0f 98rWlbc2bkk2nNhnUIcCgwVH7OhzYjv3l6lFILo9nF6LjqUasNguA5gEfMUB6n4bIRKJqLf eRtLYMjtTCIMgD7pXmutr07pASMacRSd+ukhTBuBpfNB9hkiVU9wk3N+QPAoHtPSWnfc0I8 t5qKxTAXJItS7oK6gqLzA== X-UI-Out-Filterresults: notjunk:1; V01:K0:g8pBklBEqzs=:1dXO1qp7dkO9RvAwOfS4sg n/8wGdzxdEPTJsF3iVn1jPI+GDuzOOyj1qn9U4gHNRl6eecn0fOjBgsPziqEyRCiaEgrlKdR8 EmzTvhYcQS9AElORFw5yQGFQBH8Zx9cyDGVZCeGwQhgR4ntAHzZ/jBAj20LLid0nNoPKUQ3bZ CSeTKiSSGezYI7auJ3tOtaRuz5EijuOy99bpAx25XyMOr4QNjH2T2aa91XFH9LWoakXwRq1tV CX1PFG8M4+bG45tNi4wIUNkb2q1xH47GeCnzy2GrvAoFft9zowYuGzU8hiKFAjPQMZl5lvgbG f+x56ZXQh9gsX6AGEB/ERXw179fWISkCmz6MtGYU1PEdqj01EoceZoZqEkdYBoJzal6JJXqiE R3wPuAD+/wm9T+gai4JfMLGz+aGUXbh0vWnOwdTGJC38ZPc63CjKdwa6o0QAQrEJDw+xtEL5U jW+pxhzna5ZpQfTVH/FTfklqDnfh+3n2YSONmIcV/Ibe8EygnAaOp42ubjGlVmOFE2vCY7dC5 oSpEc0M5hCgpvjmfefWwUUs/cZ29MvFn09xpgA/3FP8c6k0ccWBl5/0caXCf621joWQNpBDgF DsUBO6Umfr5pEB2zgs9CbiwpCBSL3aIaWVU6xBbTLICkHBVrjyLTh6l4BHmCgYc2SdXFa0tA+ 6OAZZ0XS5wWhJ/qPB7JTfQ3lx1ljlktpdmc3PKsjlUCiGy3sJoAZieVTledkjlsukcFZkW2Yo Gu1fdd/XbKgfs9HJRNYhCPTNhXXo/v2AvnnbzARX7juwq3inadc+sAv8I+0MQcyzMqpxXjNTo yfA41uF Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 8 Mar 2017 12:50:14 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl“ pointed information out like the following. Comparison to NULL could be written !… Thus fix affected source code places. Signed-off-by: Markus Elfring Acked-By: Devesh Sharma Reviewed-by: Yuval Shaia --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index bfd86fd08847..bd719e7f134e 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -267,7 +267,7 @@ static int ocrdma_add_mmap(struct ocrdma_ucontext *uctx, u64 phy_addr, struct ocrdma_mm *mm; mm = kzalloc(sizeof(*mm), GFP_KERNEL); - if (mm == NULL) + if (!mm) return -ENOMEM; mm->key.phy_addr = phy_addr; mm->key.len = len; @@ -1187,7 +1187,7 @@ static int ocrdma_add_qpn_map(struct ocrdma_dev *dev, struct ocrdma_qp *qp) { int status = -EINVAL; - if (qp->id < OCRDMA_MAX_QP && dev->qp_tbl[qp->id] == NULL) { + if (qp->id < OCRDMA_MAX_QP && !dev->qp_tbl[qp->id]) { dev->qp_tbl[qp->id] = qp; status = 0; } @@ -1355,11 +1355,11 @@ static int ocrdma_alloc_wr_id_tbl(struct ocrdma_qp *qp) { qp->wqe_wr_id_tbl = kcalloc(qp->sq.max_cnt, sizeof(*qp->wqe_wr_id_tbl), GFP_KERNEL); - if (qp->wqe_wr_id_tbl == NULL) + if (!qp->wqe_wr_id_tbl) return -ENOMEM; qp->rqe_wr_id_tbl = kcalloc(qp->rq.max_cnt, sizeof(*qp->rqe_wr_id_tbl), GFP_KERNEL); - if (qp->rqe_wr_id_tbl == NULL) + if (!qp->rqe_wr_id_tbl) return -ENOMEM; return 0; @@ -1419,7 +1419,7 @@ struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd, goto gen_err; } ocrdma_set_qp_init_params(qp, pd, attrs); - if (udata == NULL) + if (!udata) qp->cap_flags |= (OCRDMA_QP_MW_BIND | OCRDMA_QP_LKEY0 | OCRDMA_QP_FAST_REG); @@ -1431,7 +1431,7 @@ struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd, goto mbx_err; /* user space QP's wr_id table are managed in library */ - if (udata == NULL) { + if (!udata) { status = ocrdma_alloc_wr_id_tbl(qp); if (status) goto map_err; @@ -1892,11 +1892,11 @@ struct ib_srq *ocrdma_create_srq(struct ib_pd *ibpd, if (status) goto err; - if (udata == NULL) { + if (!udata) { srq->rqe_wr_id_tbl = kcalloc(srq->rq.max_cnt, sizeof(*srq->rqe_wr_id_tbl), GFP_KERNEL); - if (srq->rqe_wr_id_tbl == NULL) + if (!srq->rqe_wr_id_tbl) goto arm_err; srq->bit_fields_len = (srq->rq.max_cnt / 32) + @@ -1904,7 +1904,7 @@ struct ib_srq *ocrdma_create_srq(struct ib_pd *ibpd, srq->idx_bit_fields = kmalloc_array(srq->bit_fields_len, sizeof(*srq->idx_bit_fields), GFP_KERNEL); - if (srq->idx_bit_fields == NULL) + if (!srq->idx_bit_fields) goto arm_err; memset(srq->idx_bit_fields, 0xff, srq->bit_fields_len * sizeof(*srq->idx_bit_fields)); @@ -2878,7 +2878,7 @@ static int ocrdma_poll_hwcq(struct ocrdma_cq *cq, int num_entries, if (qpn == 0) goto skip_cqe; qp = dev->qp_tbl[qpn]; - BUG_ON(qp == NULL); + BUG_ON(!qp); expand = is_cqe_for_sq(cqe) ? ocrdma_poll_scqe(qp, cqe, ibwc, &polled, &stop)