linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Remove unneeded code in sys_getpriority
@ 2008-02-03  3:04 Rabin Vincent
  2008-02-03  9:54 ` Frank Seidel
  0 siblings, 1 reply; 4+ messages in thread
From: Rabin Vincent @ 2008-02-03  3:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

This check is not required because the condition is always true.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 kernel/sys.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index d1fe71e..a001974 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -212,11 +212,8 @@ asmlinkage long sys_getpriority(int which, int who)
 				p = find_task_by_vpid(who);
 			else
 				p = current;
-			if (p) {
-				niceval = 20 - task_nice(p);
-				if (niceval > retval)
-					retval = niceval;
-			}
+			if (p)
+				retval = 20 - task_nice(p);
 			break;
 		case PRIO_PGRP:
 			if (who)
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Remove unneeded code in sys_getpriority
  2008-02-03  3:04 [PATCH] Remove unneeded code in sys_getpriority Rabin Vincent
@ 2008-02-03  9:54 ` Frank Seidel
  2008-02-03 17:58   ` Rabin Vincent
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Seidel @ 2008-02-03  9:54 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: Andrew Morton, Linux Kernel

On Sunday 03 February 2008 04:04, Rabin Vincent wrote:
> This check is not required because the condition is always true.
> ...
> -				if (niceval > retval)
> -					retval = niceval;
> +				retval = 20 - task_nice(p);

Thats surely correct, but on the other hand currently those
case blocks are quite independet of their possition/could easily
be rearranged now .. or think of another case is put ahead.
Then this could mess up things.

Thanks,
Frank

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Remove unneeded code in sys_getpriority
  2008-02-03  9:54 ` Frank Seidel
@ 2008-02-03 17:58   ` Rabin Vincent
  2008-02-03 18:10     ` Frank Seidel
  0 siblings, 1 reply; 4+ messages in thread
From: Rabin Vincent @ 2008-02-03 17:58 UTC (permalink / raw)
  To: Frank Seidel; +Cc: Andrew Morton, Linux Kernel

On Sun, Feb 03, 2008 at 10:54:45AM +0100, Frank Seidel wrote:
> On Sunday 03 February 2008 04:04, Rabin Vincent wrote:
> > This check is not required because the condition is always true.
> > ...
> > -				if (niceval > retval)
> > -					retval = niceval;
> > +				retval = 20 - task_nice(p);
> 
> Thats surely correct, but on the other hand currently those
> case blocks are quite independet of their possition/could easily
> be rearranged now .. or think of another case is put ahead.
> Then this could mess up things.

Do you mean the PRIO_* cases in the switch?  They're still independent
of position after the patch because they don't fall through.

> Thanks,
> Frank

Rabin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Remove unneeded code in sys_getpriority
  2008-02-03 17:58   ` Rabin Vincent
@ 2008-02-03 18:10     ` Frank Seidel
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Seidel @ 2008-02-03 18:10 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: Andrew Morton, Linux Kernel

On Sunday 03 February 2008 18:58, Rabin Vincent wrote:
> Do you mean the PRIO_* cases in the switch?  They're still independent
> of position after the patch because they don't fall through.

Yes, sure, this is fully correct now. Just if somehting whatsoever
is put ahead touching retval one need to take care of this here.
But as i don't have enough experience to know if this likely at all i'm
fully fine with it. Just wanted to note one should think about if
its worth the change.

Thanks,
Frank

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-03 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-03  3:04 [PATCH] Remove unneeded code in sys_getpriority Rabin Vincent
2008-02-03  9:54 ` Frank Seidel
2008-02-03 17:58   ` Rabin Vincent
2008-02-03 18:10     ` Frank Seidel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).