public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] kernel-sched: Adjust four checks for null pointers
Date: Sat, 6 May 2017 21:42:50 +0200	[thread overview]
Message-ID: <15f374e1-e55a-93fb-d475-194c34be41c9@users.sourceforge.net> (raw)
In-Reply-To: <ece07743-9bbb-e396-b562-ba161c3eb9b8@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 6 May 2017 21:17:36 +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 place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 kernel/sched/debug.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index ff599b7f10b6..4a1abb61d1f7 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -231,7 +231,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep)
 	for (entry = *tablep; entry->mode; entry++) {
 		if (entry->child)
 			sd_free_ctl_entry(&entry->child);
-		if (entry->proc_handler == NULL)
+		if (!entry->proc_handler)
 			kfree(entry->procname);
 	}
 
@@ -265,7 +265,7 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
 {
 	struct ctl_table *table = sd_alloc_ctl_entry(14);
 
-	if (table == NULL)
+	if (!table)
 		return NULL;
 
 	set_table_entry(&table[0], "min_interval", &sd->min_interval,
@@ -311,7 +311,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu)
 	for_each_domain(cpu, sd)
 		domain_num++;
 	entry = table = sd_alloc_ctl_entry(domain_num + 1);
-	if (table == NULL)
+	if (!table)
 		return NULL;
 
 	i = 0;
@@ -336,7 +336,7 @@ void register_sched_domain_sysctl(void)
 	WARN_ON(sd_ctl_dir[0].child);
 	sd_ctl_dir[0].child = entry;
 
-	if (entry == NULL)
+	if (!entry)
 		return;
 
 	for_each_possible_cpu(i) {
-- 
2.12.2

  parent reply	other threads:[~2017-05-06 19:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06 19:40 [PATCH 0/3] kernel-sched: Fine-tuning for eight function implementations SF Markus Elfring
2017-05-06 19:41 ` [PATCH 1/3] kernel-sched: Use seq_putc() in three functions SF Markus Elfring
2017-05-06 19:42 ` SF Markus Elfring [this message]
2017-05-06 19:43 ` [PATCH 3/3] kernel-sched: Combine two seq_printf() calls into one in show_schedstat() SF Markus Elfring

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=15f374e1-e55a-93fb-d475-194c34be41c9@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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