All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] Fix unused-but-set-variable warnings
@ 2011-06-01 12:56 Christophe Fergeau
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning Christophe Fergeau
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Christophe Fergeau @ 2011-06-01 12:56 UTC (permalink / raw)
  To: qemu-devel

Hi,

Here are a few more "unused-but-set-variable" warning fixes which I got
when rebuilding qemu. I can fold the other 2 patches that were already
sent to this list in this series if needed.

The 3rd hunk of the ehci patch needs a review from someone who knows the
code, different values are assigned to the "pid" variable which the patch
deletes, and further down in the function, ehci->pid is used, so maybe
an "ehci->pid = pid;" line is missing in this function, in which case the
patch would hide a bug instead of solving it.

Similarly, the variable removed from the linux-user patch is assigned
different values depending on some conditions, maybe it's not right to
remove it but it should be used for "something".

Christophe


Christophe Fergeau (3):
  lsi: Fix unused-but-set-variable warning
  ehci: Fix unused-but-set-variable warning
  linux-user: Fix unused-but-set-variable warning

 hw/lsi53c895a.c        |    2 --
 hw/usb-ehci.c          |   11 +----------
 linux-user/linuxload.c |    9 +--------
 3 files changed, 2 insertions(+), 20 deletions(-)

-- 
1.7.5.2

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

* [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning
  2011-06-01 12:56 [Qemu-devel] [PATCH 0/3] Fix unused-but-set-variable warnings Christophe Fergeau
@ 2011-06-01 12:56 ` Christophe Fergeau
  2011-06-01 14:19   ` Paolo Bonzini
  2011-06-10 18:45   ` Stefan Hajnoczi
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 2/3] ehci: " Christophe Fergeau
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 3/3] linux-user: " Christophe Fergeau
  2 siblings, 2 replies; 10+ messages in thread
From: Christophe Fergeau @ 2011-06-01 12:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christophe Fergeau

This warning is new in gcc 4.6.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
---
 hw/lsi53c895a.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 83084b6..90c6cbc 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -889,7 +889,6 @@ static void lsi_do_msgout(LSIState *s)
     uint8_t msg;
     int len;
     uint32_t current_tag;
-    SCSIDevice *current_dev;
     lsi_request *current_req, *p, *p_next;
     int id;
 
@@ -901,7 +900,6 @@ static void lsi_do_msgout(LSIState *s)
         current_req = lsi_find_by_tag(s, current_tag);
     }
     id = (current_tag >> 8) & 0xf;
-    current_dev = s->bus.devs[id];
 
     DPRINTF("MSG out len=%d\n", s->dbc);
     while (s->dbc) {
-- 
1.7.5.2

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

* [Qemu-devel] [PATCH 2/3] ehci: Fix unused-but-set-variable warning
  2011-06-01 12:56 [Qemu-devel] [PATCH 0/3] Fix unused-but-set-variable warnings Christophe Fergeau
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning Christophe Fergeau
@ 2011-06-01 12:56 ` Christophe Fergeau
  2011-06-01 15:53   ` David Ahern
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 3/3] linux-user: " Christophe Fergeau
  2 siblings, 1 reply; 10+ messages in thread
From: Christophe Fergeau @ 2011-06-01 12:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Christophe Fergeau

This warning is new in gcc 4.6.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
---
 hw/usb-ehci.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index f63519e..8a7b1bb 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -523,11 +523,8 @@ static void ehci_detach(USBPort *port)
 static void ehci_reset(void *opaque)
 {
     EHCIState *s = opaque;
-    uint8_t *pci_conf;
     int i;
 
-    pci_conf = s->dev.config;
-
     memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE);
 
     s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH;
@@ -1105,18 +1102,15 @@ static int ehci_process_itd(EHCIState *ehci,
     int ret;
     int i, j;
     int ptr;
-    int pid;
     int pg;
     int len;
     int dir;
     int devadr;
     int endp;
-    int maxpkt;
 
     dir =(itd->bufptr[1] & ITD_BUFPTR_DIRECTION);
     devadr = get_field(itd->bufptr[0], ITD_BUFPTR_DEVADDR);
     endp = get_field(itd->bufptr[0], ITD_BUFPTR_EP);
-    maxpkt = get_field(itd->bufptr[1], ITD_BUFPTR_MAXPKT);
 
     for(i = 0; i < 8; i++) {
         if (itd->transact[i] & ITD_XACT_ACTIVE) {
@@ -1134,11 +1128,8 @@ static int ehci_process_itd(EHCIState *ehci,
 
             DPRINTF("ISOCH: buffer %08X len %d\n", ptr, len);
 
-            if (!dir) {
+            if (!dir)
                 cpu_physical_memory_rw(ptr, &ehci->buffer[0], len, 0);
-                pid = USB_TOKEN_OUT;
-            } else
-                pid = USB_TOKEN_IN;
 
             ret = USB_RET_NODEV;
 
-- 
1.7.5.2

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

* [Qemu-devel] [PATCH 3/3] linux-user: Fix unused-but-set-variable warning
  2011-06-01 12:56 [Qemu-devel] [PATCH 0/3] Fix unused-but-set-variable warnings Christophe Fergeau
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning Christophe Fergeau
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 2/3] ehci: " Christophe Fergeau
@ 2011-06-01 12:56 ` Christophe Fergeau
  2 siblings, 0 replies; 10+ messages in thread
From: Christophe Fergeau @ 2011-06-01 12:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christophe Fergeau

This warning is new in gcc 4.6.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
---
 linux-user/linuxload.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c
index ac8c486..e66a4ea 100644
--- a/linux-user/linuxload.c
+++ b/linux-user/linuxload.c
@@ -57,7 +57,7 @@ static int prepare_binprm(struct linux_binprm *bprm)
 {
     struct stat		st;
     int mode;
-    int retval, id_change;
+    int retval;
 
     if(fstat(bprm->fd, &st) < 0) {
 	return(-errno);
@@ -73,14 +73,10 @@ static int prepare_binprm(struct linux_binprm *bprm)
 
     bprm->e_uid = geteuid();
     bprm->e_gid = getegid();
-    id_change = 0;
 
     /* Set-uid? */
     if(mode & S_ISUID) {
     	bprm->e_uid = st.st_uid;
-	if(bprm->e_uid != geteuid()) {
-	    id_change = 1;
-	}
     }
 
     /* Set-gid? */
@@ -91,9 +87,6 @@ static int prepare_binprm(struct linux_binprm *bprm)
      */
     if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
 	bprm->e_gid = st.st_gid;
-	if (!in_group_p(bprm->e_gid)) {
-		id_change = 1;
-	}
     }
 
     retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE);
-- 
1.7.5.2

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

* Re: [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning Christophe Fergeau
@ 2011-06-01 14:19   ` Paolo Bonzini
  2011-06-10 16:36     ` Peter Maydell
  2011-06-10 18:45   ` Stefan Hajnoczi
  1 sibling, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2011-06-01 14:19 UTC (permalink / raw)
  To: qemu-devel

On 06/01/2011 02:56 PM, Christophe Fergeau wrote:
> This warning is new in gcc 4.6.
>
> Signed-off-by: Christophe Fergeau<cfergeau@redhat.com>
> ---
>   hw/lsi53c895a.c |    2 --
>   1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
> index 83084b6..90c6cbc 100644
> --- a/hw/lsi53c895a.c
> +++ b/hw/lsi53c895a.c
> @@ -889,7 +889,6 @@ static void lsi_do_msgout(LSIState *s)
>       uint8_t msg;
>       int len;
>       uint32_t current_tag;
> -    SCSIDevice *current_dev;
>       lsi_request *current_req, *p, *p_next;
>       int id;
>
> @@ -901,7 +900,6 @@ static void lsi_do_msgout(LSIState *s)
>           current_req = lsi_find_by_tag(s, current_tag);
>       }
>       id = (current_tag>>  8)&  0xf;
> -    current_dev = s->bus.devs[id];
>
>       DPRINTF("MSG out len=%d\n", s->dbc);
>       while (s->dbc) {

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [Qemu-devel] [PATCH 2/3] ehci: Fix unused-but-set-variable warning
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 2/3] ehci: " Christophe Fergeau
@ 2011-06-01 15:53   ` David Ahern
  2011-06-01 16:21     ` Christophe Fergeau
  0 siblings, 1 reply; 10+ messages in thread
From: David Ahern @ 2011-06-01 15:53 UTC (permalink / raw)
  To: Christophe Fergeau; +Cc: qemu-devel, Gerd Hoffmann

On 06/01/2011 06:56 AM, Christophe Fergeau wrote:
> @@ -1134,11 +1128,8 @@ static int ehci_process_itd(EHCIState *ehci,
>  
>              DPRINTF("ISOCH: buffer %08X len %d\n", ptr, len);
>  
> -            if (!dir) {
> +            if (!dir)
>                  cpu_physical_memory_rw(ptr, &ehci->buffer[0], len, 0);
> -                pid = USB_TOKEN_OUT;
> -            } else
> -                pid = USB_TOKEN_IN;
>  
>              ret = USB_RET_NODEV;
>  

I think you want those to be ehci->pid instead of deleting them.

David

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

* Re: [Qemu-devel] [PATCH 2/3] ehci: Fix unused-but-set-variable warning
  2011-06-01 15:53   ` David Ahern
@ 2011-06-01 16:21     ` Christophe Fergeau
  0 siblings, 0 replies; 10+ messages in thread
From: Christophe Fergeau @ 2011-06-01 16:21 UTC (permalink / raw)
  To: David Ahern; +Cc: qemu-devel, Gerd Hoffmann

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

On Wed, Jun 01, 2011 at 09:53:46AM -0600, David Ahern wrote:
> I think you want those to be ehci->pid instead of deleting them.

Yeah, this is exactly what I was wondering while making this patch,
but couldn't decide which one was supposed to be given my total lack
of knowledge of USB and of this code :)

Thanks,

Christophe

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning
  2011-06-01 14:19   ` Paolo Bonzini
@ 2011-06-10 16:36     ` Peter Maydell
  2011-06-10 19:21       ` Richard Henderson
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2011-06-10 16:36 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Paolo Bonzini, qemu-devel

Stefan, if you're picking up gcc warning fixes for the trivial
tree, how about this one?

(I think the other gcc warning fixes are either:
 * in the most recent usb pull request
 * linux-user
 * target-alpha
which all have a clear owner/interested person.)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

On 1 June 2011 15:19, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 06/01/2011 02:56 PM, Christophe Fergeau wrote:
>>
>> This warning is new in gcc 4.6.
>>
>> Signed-off-by: Christophe Fergeau<cfergeau@redhat.com>
>> ---
>>  hw/lsi53c895a.c |    2 --
>>  1 files changed, 0 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
>> index 83084b6..90c6cbc 100644
>> --- a/hw/lsi53c895a.c
>> +++ b/hw/lsi53c895a.c
>> @@ -889,7 +889,6 @@ static void lsi_do_msgout(LSIState *s)
>>      uint8_t msg;
>>      int len;
>>      uint32_t current_tag;
>> -    SCSIDevice *current_dev;
>>      lsi_request *current_req, *p, *p_next;
>>      int id;
>>
>> @@ -901,7 +900,6 @@ static void lsi_do_msgout(LSIState *s)
>>          current_req = lsi_find_by_tag(s, current_tag);
>>      }
>>      id = (current_tag>>  8)&  0xf;
>> -    current_dev = s->bus.devs[id];
>>
>>      DPRINTF("MSG out len=%d\n", s->dbc);
>>      while (s->dbc) {
>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning
  2011-06-01 12:56 ` [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning Christophe Fergeau
  2011-06-01 14:19   ` Paolo Bonzini
@ 2011-06-10 18:45   ` Stefan Hajnoczi
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2011-06-10 18:45 UTC (permalink / raw)
  To: Christophe Fergeau; +Cc: qemu-devel

On Wed, Jun 01, 2011 at 02:56:30PM +0200, Christophe Fergeau wrote:
> This warning is new in gcc 4.6.
> 
> Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
> ---
>  hw/lsi53c895a.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan

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

* Re: [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning
  2011-06-10 16:36     ` Peter Maydell
@ 2011-06-10 19:21       ` Richard Henderson
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2011-06-10 19:21 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Stefan Hajnoczi, qemu-devel, Paolo Bonzini

On 06/10/2011 09:36 AM, Peter Maydell wrote:
> Stefan, if you're picking up gcc warning fixes for the trivial
> tree, how about this one?
> 
> (I think the other gcc warning fixes are either:
>  * in the most recent usb pull request
>  * linux-user
>  * target-alpha

Speaking of, anyone willing to pull and/or look at my target-alpha patchset?
I've been re-posting and/or pinging it for more than 2 months now with no
more than one spelling error as feedback...


r~

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

end of thread, other threads:[~2011-06-10 19:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 12:56 [Qemu-devel] [PATCH 0/3] Fix unused-but-set-variable warnings Christophe Fergeau
2011-06-01 12:56 ` [Qemu-devel] [PATCH 1/3] lsi: Fix unused-but-set-variable warning Christophe Fergeau
2011-06-01 14:19   ` Paolo Bonzini
2011-06-10 16:36     ` Peter Maydell
2011-06-10 19:21       ` Richard Henderson
2011-06-10 18:45   ` Stefan Hajnoczi
2011-06-01 12:56 ` [Qemu-devel] [PATCH 2/3] ehci: " Christophe Fergeau
2011-06-01 15:53   ` David Ahern
2011-06-01 16:21     ` Christophe Fergeau
2011-06-01 12:56 ` [Qemu-devel] [PATCH 3/3] linux-user: " Christophe Fergeau

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.