From patchwork Wed Feb 8 21:17:42 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: 9563439 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 723D3601C3 for ; Wed, 8 Feb 2017 21:18:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D12E7284F6 for ; Wed, 8 Feb 2017 21:18:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C601928511; Wed, 8 Feb 2017 21:18:53 +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 51C8A284F6 for ; Wed, 8 Feb 2017 21:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751664AbdBHVS2 (ORCPT ); Wed, 8 Feb 2017 16:18:28 -0500 Received: from mout.web.de ([212.227.15.4]:52319 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbdBHVSO (ORCPT ); Wed, 8 Feb 2017 16:18:14 -0500 Received: from [192.168.1.2] ([77.181.90.255]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5x4z-1cD2Y50ZHl-00xone; Wed, 08 Feb 2017 22:17:44 +0100 Subject: [PATCH 07/14] RDMA/cxgb4: Adjust three checks for null pointers To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <14a380a4-2aa3-b2cc-3207-99e86b5964ea@users.sourceforge.net> Date: Wed, 8 Feb 2017 22:17:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> X-Provags-ID: V03:K0:/Q1ckFiACJpfLts9TUZaMBaAcEAIFBE0Ha1G43Cy8YiQ30wnxkN IdIx+Ylqi7JiScUs0X3b+xh/yLXVFeejZRcJZHdy5CTyhd1PAqyFROT/A8ijPSEiPqhEGtT 3xC1Cw1J+lmVUhDSmjK4wuh5H1eJSaQAzPoL2TWWmSVWna91LXBp+4PqhYzUn64pVNiswaK TKqczzWl11+UOikIly9pg== X-UI-Out-Filterresults: notjunk:1; V01:K0:MAlAl+5VY2A=:YinY3r3cIJMBkI12q4Gs0E NGl7rLO8zAC+AvPn4PWVsmOChb7wCWRBcJVkduBOwHyT2dqILSfqREmXw69kp+/eo1t5++yBD O3zbtyqj9DhPcmXOwpUydPkdyGGdfJz8ai7G/Ylb/9Xo1KOx67kE73GPgw4fyoUPDlyZrBue3 zbcBn4A1ZhdcQX/c8SFfTwZXfOu7S1nKctESpi9a4My7hsq4LDhzZ34BpREhbm5KbGgzo4n21 3w4dAmmjpsD3xYGtOjfWVlR8UckBr3AjBt3mFsATVRGMyqIvLBPohepjZD4RxU0imo02qYnf0 IU5MyhG2TKs/WfMA1SiBEQBbV1XpgUB6NMBecYilKbX0D6ckNZyN3S76++198f6nCyNFyDd4U BOGfIh6EzeLw85UKlmc401sNac7xDOBPdjdFEXADouXNyvD7sjzCDuTZMw2Rm3nh1tL0wR+mk cRgjzzETLiKxnEUO+S4FdsSn68Wlvt4/unu952sbA1xmQm1Eqr1Kc0UWYXWn6NsKgiiJSVyhw SbvPxqo4D3d5scg5YSL63FoRJMuIQJQcJcKCl+4jz+7xp9WaQ3UEzMHRKpx/w6ABjtSTSJbvZ AqBdWUf4cRAzMAdhwnJITuSk+sDM3bL4qYvsYczLz65Uiqxhoze34QN8C8PSK4wwO5fMRueES QQtN4jeneWe+FN5bXldZ+Geb5cSlcJRM94aCjCSMEzm7P6GNaV/DAgr7dMLBJsLjqWYzTDnDz +INEKccyplxr8x7TeBknPSE03V7MLa2AjqB0N4iaSPZg3OSIdHUEHiGBFDFe16+WK005mYSBr OV3oahC 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 Feb 2017 17:10: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 the affected source code places. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/cxgb4/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 90fa96abb5bc..7f30bfd71eb2 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -1126,10 +1126,10 @@ static inline int recv_rx_pkt(struct c4iw_dev *dev, const struct pkt_gl *gl, goto out; skb = copy_gl_to_skb_pkt(gl , rsp, dev->rdev.lldi.sge_pktshift); - if (skb == NULL) + if (!skb) goto out; - if (c4iw_handlers[opcode] == NULL) { + if (!c4iw_handlers[opcode]) { pr_info("%s no handler opcode 0x%x...\n", __func__, opcode); kfree_skb(skb); @@ -1149,7 +1149,7 @@ static int c4iw_uld_rx_handler(void *handle, const __be64 *rsp, struct sk_buff *skb; u8 opcode; - if (gl == NULL) { + if (!gl) { /* omit RSS and rsp_ctrl at end of descriptor */ unsigned int len = 64 - sizeof(struct rsp_ctrl) - 8;