[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1203198314.6298.6.camel@lappy>
Date: Sat, 16 Feb 2008 22:45:14 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: Harvey Harrison <harvey.harrison@...il.com>,
Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] sched: trivial sparse warning in sched.c
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@...il.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.
--
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