mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasikantha babu <sasikanth.v19@gmail.com>
To: Paul Gortmaker <paul.gortmaker@windriver.com>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Sasikantha babu <sasikanth.v19@gmail.com>
Subject: [PATCH] Removed less than zero check, since Schedule_timeout return value is guaranteed to be non-negative
Date: Tue, 10 Apr 2012 14:32:27 +0530	[thread overview]
Message-ID: <1334048547-2983-1-git-send-email-sasikanth.v19@gmail.com> (raw)

validating timeout against negiatve value is not required, schedule_timeout always returns >= 0.

If someone passes timeout as negative value, Instead of simply returning -ETIME we have to warn them (schedule_timeout 
is already doing it by dumping stack and priniting an error message) about it. 

We must return -ETIME on timer expiry not for invaild timeouts.

Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
 kernel/semaphore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/semaphore.c b/kernel/semaphore.c
index 60636a4..029c05b 100644
--- a/kernel/semaphore.c
+++ b/kernel/semaphore.c
@@ -214,7 +214,7 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
 	for (;;) {
 		if (signal_pending_state(state, task))
 			goto interrupted;
-		if (timeout <= 0)
+		if (!timeout)
 			goto timed_out;
 		__set_task_state(task, state);
 		raw_spin_unlock_irq(&sem->lock);
-- 
1.7.3.4


                 reply	other threads:[~2012-04-10  9:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1334048547-2983-1-git-send-email-sasikanth.v19@gmail.com \
    --to=sasikanth.v19@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paul.gortmaker@windriver.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®