All of lore.kernel.org
 help / color / mirror / Atom feed
* arch/i386/kernel/msr.c(198): remark #593: variable "rv" was set but never used
@ 2006-11-21 19:43 d binderman
  2006-11-21 20:27 ` [PATCH] i386 msr: remove unused variable David Rientjes
  0 siblings, 1 reply; 4+ messages in thread
From: d binderman @ 2006-11-21 19:43 UTC (permalink / raw)
  To: Linux-Kernel


Hello there,

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

It said

arch/x86_64/kernel/../../i386/kernel/msr.c(198): remark #593: variable "rv" 
was set but never used

The source code is

    size_t rv;

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


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

* [PATCH] i386 msr: remove unused variable
  2006-11-21 19:43 arch/i386/kernel/msr.c(198): remark #593: variable "rv" was set but never used d binderman
@ 2006-11-21 20:27 ` David Rientjes
  2006-11-21 21:00   ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: David Rientjes @ 2006-11-21 20:27 UTC (permalink / raw)
  To: d binderman; +Cc: H. Peter Anvin, linux-kernel

Remove unused variable in msr_write().

Reported by D Binderman <dcb314@hotmail.com>.

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: David Rientjes <rientjes@cs.washington.edu>
---
 arch/i386/kernel/msr.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index d535cdb..331bd59 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -195,7 +195,6 @@ static ssize_t msr_write(struct file *fi
 {
 	const u32 __user *tmp = (const u32 __user *)buf;
 	u32 data[2];
-	size_t rv;
 	u32 reg = *ppos;
 	int cpu = iminor(file->f_dentry->d_inode);
 	int err;
@@ -203,7 +202,7 @@ static ssize_t msr_write(struct file *fi
 	if (count % 8)
 		return -EINVAL;	/* Invalid chunk size */
 
-	for (rv = 0; count; count -= 8) {
+	for (; count; count -= 8) {
 		if (copy_from_user(&data, tmp, 8))
 			return -EFAULT;
 		err = do_wrmsr(cpu, reg, data[0], data[1]);

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

* Re: [PATCH] i386 msr: remove unused variable
  2006-11-21 20:27 ` [PATCH] i386 msr: remove unused variable David Rientjes
@ 2006-11-21 21:00   ` Adrian Bunk
  2006-11-21 21:03     ` David Rientjes
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2006-11-21 21:00 UTC (permalink / raw)
  To: David Rientjes; +Cc: d binderman, H. Peter Anvin, linux-kernel

On Tue, Nov 21, 2006 at 12:27:22PM -0800, David Rientjes wrote:
> Remove unused variable in msr_write().
> 
> Reported by D Binderman <dcb314@hotmail.com>.
> 
> Cc: H. Peter Anvin <hpa@zytor.com>
> Signed-off-by: David Rientjes <rientjes@cs.washington.edu>
> ---
>  arch/i386/kernel/msr.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
> index d535cdb..331bd59 100644
> --- a/arch/i386/kernel/msr.c
> +++ b/arch/i386/kernel/msr.c
> @@ -195,7 +195,6 @@ static ssize_t msr_write(struct file *fi
>  {
>  	const u32 __user *tmp = (const u32 __user *)buf;
>  	u32 data[2];
> -	size_t rv;
>  	u32 reg = *ppos;
>  	int cpu = iminor(file->f_dentry->d_inode);
>  	int err;
> @@ -203,7 +202,7 @@ static ssize_t msr_write(struct file *fi
>  	if (count % 8)
>  		return -EINVAL;	/* Invalid chunk size */
>  
> -	for (rv = 0; count; count -= 8) {
> +	for (; count; count -= 8) {
>...

What about changing this to a while() loop?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] i386 msr: remove unused variable
  2006-11-21 21:00   ` Adrian Bunk
@ 2006-11-21 21:03     ` David Rientjes
  0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2006-11-21 21:03 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: d binderman, H. Peter Anvin, linux-kernel

On Tue, 21 Nov 2006, Adrian Bunk wrote:

> On Tue, Nov 21, 2006 at 12:27:22PM -0800, David Rientjes wrote:
> > Remove unused variable in msr_write().
> > 
> > Reported by D Binderman <dcb314@hotmail.com>.
> > 
> > Cc: H. Peter Anvin <hpa@zytor.com>
> > Signed-off-by: David Rientjes <rientjes@cs.washington.edu>
> > ---
> >  arch/i386/kernel/msr.c |    3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
> > index d535cdb..331bd59 100644
> > --- a/arch/i386/kernel/msr.c
> > +++ b/arch/i386/kernel/msr.c
> > @@ -195,7 +195,6 @@ static ssize_t msr_write(struct file *fi
> >  {
> >  	const u32 __user *tmp = (const u32 __user *)buf;
> >  	u32 data[2];
> > -	size_t rv;
> >  	u32 reg = *ppos;
> >  	int cpu = iminor(file->f_dentry->d_inode);
> >  	int err;
> > @@ -203,7 +202,7 @@ static ssize_t msr_write(struct file *fi
> >  	if (count % 8)
> >  		return -EINVAL;	/* Invalid chunk size */
> >  
> > -	for (rv = 0; count; count -= 8) {
> > +	for (; count; count -= 8) {
> >...
> 
> What about changing this to a while() loop?
> 

Unnecessary because tmp is also incremented at the bottom of this for loop 
so there are two incremental variables.  It is not better served with a 
while loop; the absence of an initialization variable does not suggest 
such.

		David

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

end of thread, other threads:[~2006-11-21 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-21 19:43 arch/i386/kernel/msr.c(198): remark #593: variable "rv" was set but never used d binderman
2006-11-21 20:27 ` [PATCH] i386 msr: remove unused variable David Rientjes
2006-11-21 21:00   ` Adrian Bunk
2006-11-21 21:03     ` David Rientjes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.