2006-11-23 10:12:09

by David Binderman

[permalink] [raw]
Subject: kernel/hrtimer.c(511): remark #593: variable "base" was set but never used


Hello there,

I just tried to compile Linux kernel 2.6.18.3 with the Intel C
C compiler.

The compiler said

kernel/hrtimer.c(511): remark #593: variable "base" was set but never used

The source code is

struct hrtimer_base *base;

I have checked the source code and I agree with the compiler.
Suggest delete local variable.

Regards

David Binderman

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!
http://www.msn.co.uk/newsletters


2006-11-23 10:33:18

by David Rientjes

[permalink] [raw]
Subject: [PATCH] hrtimer: remove unused variable

Remove unused 'base' variable.

Cc: Thomas Gleixner <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
---
kernel/hrtimer.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index d0ba190..b55532f 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -508,11 +508,10 @@ EXPORT_SYMBOL_GPL(hrtimer_cancel);
*/
ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
{
- struct hrtimer_base *base;
unsigned long flags;
ktime_t rem;

- base = lock_hrtimer_base(timer, &flags);
+ lock_hrtimer_base(timer, &flags);
rem = ktime_sub(timer->expires, timer->base->get_time());
unlock_hrtimer_base(timer, &flags);

2006-12-12 21:40:01

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] hrtimer: remove unused variable

On Thu, 2006-11-23 at 02:33 -0800, David Rientjes wrote:
> Remove unused 'base' variable.
>

Or just use it.

Signed-off-by: Steven Rostedt <[email protected]>

Index: linux-2.6.19/kernel/hrtimer.c
===================================================================
--- linux-2.6.19.orig/kernel/hrtimer.c 2006-12-12 16:36:09.000000000 -0500
+++ linux-2.6.19/kernel/hrtimer.c 2006-12-12 16:36:36.000000000 -0500
@@ -513,7 +513,7 @@ ktime_t hrtimer_get_remaining(const stru
ktime_t rem;

base = lock_hrtimer_base(timer, &flags);
- rem = ktime_sub(timer->expires, timer->base->get_time());
+ rem = ktime_sub(timer->expires, base->get_time());
unlock_hrtimer_base(timer, &flags);

return rem;