LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/3] sched: trivial sparse warning in sched.c
@ 2008-02-15 17:56 Harvey Harrison
2008-02-16 21:11 ` Peter Zijlstra
0 siblings, 1 reply; 5+ messages in thread
From: Harvey Harrison @ 2008-02-15 17:56 UTC (permalink / raw)
To: Ingo Molnar; +Cc: LKML
kernel/sched.c:3680:3: warning: returning void-valued expression
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
kernel/sched.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index f28f19e..824d5a9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3676,8 +3676,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
struct rq *rq = this_rq();
cputime64_t tmp;
- if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
- return account_guest_time(p, cputime);
+ if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
+ account_guest_time(p, cputime);
+ return;
+ }
p->stime = cputime_add(p->stime, cputime);
--
1.5.4.1.1278.gc75be
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/3] sched: trivial sparse warning in sched.c
2008-02-15 17:56 [PATCH 2/3] sched: trivial sparse warning in sched.c Harvey Harrison
@ 2008-02-16 21:11 ` Peter Zijlstra
2008-02-16 21:27 ` Cyrill Gorcunov
0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2008-02-16 21:11 UTC (permalink / raw)
To: Harvey Harrison; +Cc: Ingo Molnar, LKML
On Fri, 2008-02-15 at 09:56 -0800, Harvey Harrison wrote:
> kernel/sched.c:3680:3: warning: returning void-valued expression
I'm wondering,... why is this wrong?
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
> kernel/sched.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index f28f19e..824d5a9 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -3676,8 +3676,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
> struct rq *rq = this_rq();
> cputime64_t tmp;
>
> - if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
> - return account_guest_time(p, cputime);
> + if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
> + account_guest_time(p, cputime);
> + return;
> + }
>
> p->stime = cputime_add(p->stime, cputime);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/3] sched: trivial sparse warning in sched.c
2008-02-16 21:11 ` Peter Zijlstra
@ 2008-02-16 21:27 ` Cyrill Gorcunov
2008-02-16 21:45 ` Peter Zijlstra
0 siblings, 1 reply; 5+ messages in thread
From: Cyrill Gorcunov @ 2008-02-16 21:27 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Harvey Harrison, Ingo Molnar, LKML
[Peter Zijlstra - Sat, Feb 16, 2008 at 10:11:29PM +0100]
|
| On Fri, 2008-02-15 at 09:56 -0800, Harvey Harrison wrote:
| > kernel/sched.c:3680:3: warning: returning void-valued expression
|
| I'm wondering,... why is this wrong?
|
| > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
| > ---
| > kernel/sched.c | 6 ++++--
| > 1 files changed, 4 insertions(+), 2 deletions(-)
| >
| > diff --git a/kernel/sched.c b/kernel/sched.c
| > index f28f19e..824d5a9 100644
| > --- a/kernel/sched.c
| > +++ b/kernel/sched.c
| > @@ -3676,8 +3676,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
| > struct rq *rq = this_rq();
| > cputime64_t tmp;
| >
| > - if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
| > - return account_guest_time(p, cputime);
| > + if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
| > + account_guest_time(p, cputime);
| > + return;
| > + }
| >
| > p->stime = cputime_add(p->stime, cputime);
| >
Hi Peter,
dont you find 'return (void)foo();' statement a bit strange (as it was in
original code)? ;) Am I wrong? /it's night here, so half a brain already
tuned off ;)/
- Cyrill -
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/3] sched: trivial sparse warning in sched.c
2008-02-16 21:27 ` Cyrill Gorcunov
@ 2008-02-16 21:45 ` Peter Zijlstra
2008-02-17 8:38 ` Cyrill Gorcunov
0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2008-02-16 21:45 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: Harvey Harrison, Ingo Molnar, LKML
On Sun, 2008-02-17 at 00:27 +0300, Cyrill Gorcunov wrote:
> [Peter Zijlstra - Sat, Feb 16, 2008 at 10:11:29PM +0100]
> |
> | On Fri, 2008-02-15 at 09:56 -0800, Harvey Harrison wrote:
> | > kernel/sched.c:3680:3: warning: returning void-valued expression
> |
> | I'm wondering,... why is this wrong?
> |
> | > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> | > ---
> | > kernel/sched.c | 6 ++++--
> | > 1 files changed, 4 insertions(+), 2 deletions(-)
> | >
> | > diff --git a/kernel/sched.c b/kernel/sched.c
> | > index f28f19e..824d5a9 100644
> | > --- a/kernel/sched.c
> | > +++ b/kernel/sched.c
> | > @@ -3676,8 +3676,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
> | > struct rq *rq = this_rq();
> | > cputime64_t tmp;
> | >
> | > - if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
> | > - return account_guest_time(p, cputime);
> | > + if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
> | > + account_guest_time(p, cputime);
> | > + return;
> | > + }
> | >
> | > p->stime = cputime_add(p->stime, cputime);
> | >
>
> Hi Peter,
>
> dont you find 'return (void)foo();' statement a bit strange (as it was in
> original code)? ;) Am I wrong? /it's night here, so half a brain already
> tuned off ;)/
void foo(void);
void bar(void)
{
return foo();
}
Maybe I'm just weird an twisted, but no, I don't find it odd. In my mind
its consistent with how all other return types function.
Not sure what the C std text says on the matter though.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/3] sched: trivial sparse warning in sched.c
2008-02-16 21:45 ` Peter Zijlstra
@ 2008-02-17 8:38 ` Cyrill Gorcunov
0 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2008-02-17 8:38 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Harvey Harrison, Ingo Molnar, LKML
[Peter Zijlstra - Sat, Feb 16, 2008 at 10:45:14PM +0100]
|
| On Sun, 2008-02-17 at 00:27 +0300, Cyrill Gorcunov wrote:
| > [Peter Zijlstra - Sat, Feb 16, 2008 at 10:11:29PM +0100]
| > |
[...]
| >
| > Hi Peter,
| >
| > dont you find 'return (void)foo();' statement a bit strange (as it was in
| > original code)? ;) Am I wrong? /it's night here, so half a brain already
| > tuned off ;)/
|
| void foo(void);
|
| void bar(void)
| {
| return foo();
| }
|
| Maybe I'm just weird an twisted, but no, I don't find it odd. In my mind
| its consistent with how all other return types function.
|
| Not sure what the C std text says on the matter though.
|
|
well, i've an obscure feeling about that. From one side I do understand that
you're *absolutely right* but the second form of statement is more clear
methink. That is what I prefer personally. Anyway the form of writting
such a statement is taste of code author - so you choose ;)
- Cyrill -
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-17 8:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 17:56 [PATCH 2/3] sched: trivial sparse warning in sched.c Harvey Harrison
2008-02-16 21:11 ` Peter Zijlstra
2008-02-16 21:27 ` Cyrill Gorcunov
2008-02-16 21:45 ` Peter Zijlstra
2008-02-17 8:38 ` Cyrill Gorcunov
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).