Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755619AbeAJK0J (ORCPT + 1 other); Wed, 10 Jan 2018 05:26:09 -0500 Received: from mout.web.de ([212.227.17.12]:63174 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751031AbeAJK0F (ORCPT ); Wed, 10 Jan 2018 05:26:05 -0500 Subject: [PATCH 4/4] sgi-xpnet: Adjust five checks for null pointers From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Arnd Bergmann , Cliff Whickman , Greg Kroah-Hartman , Robin Holt Cc: LKML References: Message-ID: <59002d3f-49f1-dcfb-4e9d-aee6f24d29f0@users.sourceforge.net> Date: Wed, 10 Jan 2018 11:25:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:H9oDw2+sWnQU3oMesGw/ztay/CU3qRdr+UiW2hMjstxJW16yI34 eUZ+hBHJD/d+cDSHQ8SJL0MrqYYvDECCMGuwJR3+t0p1qWpYexIPsQPdJXSMcPhm9wCvU02 OT24q7KgkeKXjOVGhFWLSbkzSXgQEy/xmRbdBw195Je3mYp7cLFoni/N1Cpnu17a1CLU/1R ocia/MzrmsEYHeT+L78KQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:x5eztnH7aK8=:y3LBUTSSA4VUuJW1eguO1O jL4W6kiP0FyHpKKN3sEDNMDw0PH07v02IM+uX6IUR4z5a9zyONHgHX9gAnKKeh/3rJ07udXAT 8A13wmP7bmB/MqffNAzUFcHfI28ptjhY1mvYvrfhxhWXweUSZOCHo12QILWd66WpXppAMmGMy uLby9I9jP+iP5g6p0JLNCM1JQBiqLIR/x0o+JHS13xVlKglGkc1VE3wlx9o+lh3XZ2eAuaUp1 Lue8e2a/z/CBeLcIQ8HMI/7ZoaVgf5EXkgwexrIkVLQ+BPfSGTZUhCrdLzYXWDpijrIFqImUT yjnNpzw+MQvDKqwsu8EWpg7zTYE5MLA011q78WZAzV/ON3/Ufmz9MKLif6+k+IBoofykHP+BB aLOfaRghxKflfFAW1PR4SiSIyFZMCgblwyvHiSJuF1Pl8ZqBWRZBOtnHEjlvS3nZPq+xMsOub fsyyjVi7UoVYvFculBZP75ftwqc3E/OI2BO9mZnohf/51pD/VGtXPqdq+th8Cv0of2K14wzIz +vBlunjVT+3MDhSlOFWHQDWxk/zixELprlmmkWE1pKqICTeSmyXu3Ql/8hAl5rAZtquThp9v/ zolcbrxFAnxT6wguFAFQe1o3b8c9O81rvgg/1Z8v8YyzoKpe16d612VERkz3/qQe+bv/KXjKe CCKnjF4+1B5q1c2iFYP0TIVC6fhfJHCu+IrNtYb6qyTnB1GasEbAce8+q0GF2AUNrtgZHZZjE grqjPAtT2iZMwT4Db1nC1inVCzyVRx1FtJoLusWl0Wi9fJLHZR2OUCEngvL6Cw5cXVqGxj4No OXOZHQDE5SX5sTBqLnMXKyIWAoHOwkYyCLElWnfXdmXo2pMtAU= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Wed, 10 Jan 2018 11:00: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/misc/sgi-xp/xpnet.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index 088c96a883f9..038d6bd59840 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c @@ -260,8 +260,7 @@ xpnet_connection_activity(enum xp_retval reason, short partid, int channel, switch (reason) { case xpMsgReceived: /* message received */ - DBUG_ON(data == NULL); - + DBUG_ON(!data); xpnet_receive(partid, channel, (struct xpnet_message *)data); break; @@ -341,8 +340,7 @@ xpnet_send_completed(enum xp_retval reason, short partid, int channel, { struct xpnet_pending_msg *queued_msg = (struct xpnet_pending_msg *)__qm; - DBUG_ON(queued_msg == NULL); - + DBUG_ON(!queued_msg); dev_dbg(xpnet, "message to %d notified with reason %d\n", partid, reason); @@ -425,7 +423,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) * remain, release the skb. */ queued_msg = kmalloc(sizeof(*queued_msg), GFP_ATOMIC); - if (queued_msg == NULL) { + if (!queued_msg) { dev->stats.tx_errors++; goto free_skb; } @@ -516,7 +514,7 @@ xpnet_init(void) xpnet_broadcast_partitions = kzalloc(BITS_TO_LONGS(xp_max_npartitions) * sizeof(long), GFP_KERNEL); - if (xpnet_broadcast_partitions == NULL) + if (!xpnet_broadcast_partitions) return -ENOMEM; /* @@ -525,7 +523,7 @@ xpnet_init(void) */ xpnet_device = alloc_netdev(0, XPNET_DEVICE_NAME, NET_NAME_UNKNOWN, ether_setup); - if (xpnet_device == NULL) { + if (!xpnet_device) { kfree(xpnet_broadcast_partitions); return -ENOMEM; } -- 2.15.1