public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: devel@linuxdriverproject.org,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/4] vmbus: Adjust five checks for null pointers
Date: Thu, 11 May 2017 16:19:21 +0000	[thread overview]
Message-ID: <bca350e0-9523-dd6e-4dd8-a0f8ee93dc87@users.sourceforge.net> (raw)
In-Reply-To: <dea9c6a3-0ae6-f3fe-c0d3-7f5b856e2638@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 17:52:38 +0200
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 <elfring@users.sourceforge.net>
---
 drivers/hv/vmbus_drv.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index ff94b111ed8d..b55b979ecf8a 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -93,7 +93,7 @@ static DEFINE_SEMAPHORE(hyperv_mmio_lock);
 
 static int vmbus_exists(void)
 {
-	if (hv_acpi_dev = NULL)
+	if (!hv_acpi_dev)
 		return -ENODEV;
 
 	return 0;
@@ -568,7 +568,7 @@ static const struct hv_vmbus_device_id *hv_vmbus_get_id(struct hv_driver *drv,
 		return id;
 
 	id = drv->id_table;
-	if (id = NULL)
+	if (!id)
 		return NULL; /* empty device table */
 
 	for (; !is_null_guid(&id->guid); id++)
@@ -871,7 +871,7 @@ void vmbus_on_msg_dpc(unsigned long data)
 	entry = &channel_message_table[hdr->msgtype];
 	if (entry->handler_type	= VMHT_BLOCKING) {
 		ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
-		if (ctx = NULL)
+		if (!ctx)
 			return;
 
 		INIT_WORK(&ctx->work, vmbus_onmessage_work);
@@ -894,7 +894,7 @@ static void vmbus_channel_isr(struct vmbus_channel *channel)
 	void (*callback_fn)(void *);
 
 	callback_fn = READ_ONCE(channel->onchannel_callback);
-	if (likely(callback_fn != NULL))
+	if (likely(callback_fn))
 		(*callback_fn)(channel->channel_callback_context);
 }
 
@@ -970,7 +970,7 @@ static void vmbus_isr(void)
 	union hv_synic_event_flags *event;
 	bool handled = false;
 
-	if (unlikely(page_addr = NULL))
+	if (unlikely(!page_addr))
 		return;
 
 	event = (union hv_synic_event_flags *)page_addr +
-- 
2.12.3


  parent reply	other threads:[~2017-05-11 16:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 16:14 [PATCH 0/4] VMBus: Adjustments for some function implementations SF Markus Elfring
2017-05-11 16:15 ` [PATCH 1/4] vmbus: Improve a size determination in vmbus_device_create() SF Markus Elfring
2017-05-11 16:30   ` Stephen Hemminger
2017-05-11 17:47     ` Greg KH
2017-05-11 16:17 ` [PATCH 2/4] vmbus: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-11 16:30   ` [PATCH 2/4] vmbus: Delete an error message for a failed memory allocation in vmbus_device_create Stephen Hemminger
2017-05-11 16:36     ` vmbus: Delete an error message for a failed memory allocation in vmbus_device_create() SF Markus Elfring
2017-05-11 16:42       ` Stephen Hemminger
2017-05-12  7:09     ` [PATCH 2/4] vmbus: Delete an error message for a failed memory allocation in vmbus_device_create Dan Carpenter
2017-05-12  7:32       ` vmbus: Delete an error message for a failed memory allocation in vmbus_device_create() SF Markus Elfring
2017-05-12  7:52         ` Joe Perches
2017-05-12  8:23           ` Clarification for general change acceptance SF Markus Elfring
2017-05-12  8:37             ` Julia Lawall
2017-05-12  8:45               ` SF Markus Elfring
2017-05-11 16:18 ` [PATCH 3/4] vmbus: Fix a typo in a comment line SF Markus Elfring
2017-05-11 16:33   ` Stephen Hemminger
2017-05-11 16:19 ` SF Markus Elfring [this message]
2017-05-11 16:34   ` [PATCH 4/4] vmbus: Adjust five checks for null pointers Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bca350e0-9523-dd6e-4dd8-a0f8ee93dc87@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox