lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 30 Mar 2015 16:46:17 -0700
From:	Joe Perches <joe@...ches.com>
To:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH 19/25] sched: Use bool function return values of true/false not 1/0

Use the normal return values for bool functions

Update the other sets of ret in try_wait_for_completion.

Signed-off-by: Joe Perches <joe@...ches.com>
---
 kernel/sched/auto_group.h |  2 +-
 kernel/sched/completion.c | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/auto_group.h b/kernel/sched/auto_group.h
index 8bd0471..309b6f2 100644
--- a/kernel/sched/auto_group.h
+++ b/kernel/sched/auto_group.h
@@ -45,7 +45,7 @@ static inline void autogroup_init(struct task_struct *init_task) {  }
 static inline void autogroup_free(struct task_group *tg) { }
 static inline bool task_group_is_autogroup(struct task_group *tg)
 {
-	return 0;
+	return false;
 }
 
 static inline struct task_group *
diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
index 8d0f35d..cbccaa0 100644
--- a/kernel/sched/completion.c
+++ b/kernel/sched/completion.c
@@ -255,8 +255,8 @@ EXPORT_SYMBOL(wait_for_completion_killable_timeout);
  *	try_wait_for_completion - try to decrement a completion without blocking
  *	@x:	completion structure
  *
- *	Return: 0 if a decrement cannot be done without blocking
- *		 1 if a decrement succeeded.
+ *	Return: true if a decrement cannot be done without blocking
+ *		false if a decrement succeeded.
  *
  *	If a completion is being used as a counting completion,
  *	attempt to decrement the counter without blocking. This
@@ -266,7 +266,7 @@ EXPORT_SYMBOL(wait_for_completion_killable_timeout);
 bool try_wait_for_completion(struct completion *x)
 {
 	unsigned long flags;
-	int ret = 1;
+	bool ret;
 
 	/*
 	 * Since x->done will need to be locked only
@@ -275,13 +275,15 @@ bool try_wait_for_completion(struct completion *x)
 	 * return early in the blocking case.
 	 */
 	if (!READ_ONCE(x->done))
-		return 0;
+		return false;
 
 	spin_lock_irqsave(&x->wait.lock, flags);
-	if (!x->done)
-		ret = 0;
-	else
+	if (!x->done) {
+		ret = false;
+	} else {
 		x->done--;
+		ret = true;
+	}
 	spin_unlock_irqrestore(&x->wait.lock, flags);
 	return ret;
 }
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ