Patchwork [2/2] achi: delete write-only variables

login
register
mail settings
Submitter Blue Swirl
Date Dec. 17, 2010, 9:40 p.m.
Message ID <AANLkTimqYWa0LS0guH_QQ=xTmTpGwk=zFfL7gk_Hhvop@mail.gmail.com>
Download mbox | patch
Permalink /patch/75994/
State New
Headers show

Comments

Blue Swirl - Dec. 17, 2010, 9:40 p.m.
Avoid these warnings with GCC 4.6.0:
/src/qemu/hw/ide/ahci.c: In function 'ahci_reset_port':
/src/qemu/hw/ide/ahci.c:810:14: error: variable 'tfd' set but not used
[-Werror=unused-but-set-variable]
/src/qemu/hw/ide/ahci.c: In function 'handle_cmd':
/src/qemu/hw/ide/ahci.c:1103:19: error: variable 'pr' set but not used
[-Werror=unused-but-set-variable]

CC: Alexander Graf <agraf@suse.de>
CC: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/ide/ahci.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

     AHCICmdHdr *cmd;
@@ -1113,7 +1110,6 @@ static int handle_cmd(AHCIState *s, int port, int slot)
         return -1;
     }

-    pr = &s->dev[port].port_regs;
     cmd = &((AHCICmdHdr *)s->dev[port].lst)[slot];

     if (!s->dev[port].lst) {
Alexander Graf - Dec. 17, 2010, 10:59 p.m.
On 17.12.2010, at 22:40, Blue Swirl wrote:

> Avoid these warnings with GCC 4.6.0:
> /src/qemu/hw/ide/ahci.c: In function 'ahci_reset_port':
> /src/qemu/hw/ide/ahci.c:810:14: error: variable 'tfd' set but not used
> [-Werror=unused-but-set-variable]
> /src/qemu/hw/ide/ahci.c: In function 'handle_cmd':
> /src/qemu/hw/ide/ahci.c:1103:19: error: variable 'pr' set but not used
> [-Werror=unused-but-set-variable]
> 
> CC: Alexander Graf <agraf@suse.de>
> CC: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
> hw/ide/ahci.c |    4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
> index 8ae236a..c12cc7f 100644
> --- a/hw/ide/ahci.c
> +++ b/hw/ide/ahci.c
> @@ -807,7 +807,6 @@ static void ahci_reset_port(AHCIState *s, int port)
>     AHCIPortRegs *pr = &d->port_regs;
>     IDEState *ide_state = &d->port.ifs[0];
>     uint8_t init_fis[0x20];
> -    uint32_t tfd;

Yup, that's a leftover from some refactoring :).

>     int i;
> 
>     DPRINTF(port, "reset port\n");
> @@ -848,7 +847,6 @@ static void ahci_reset_port(AHCIState *s, int port)
>     s->dev[port].port_state = STATE_RUN;
>     if (!ide_state->bs) {
>         s->dev[port].port_regs.sig = 0;
> -        tfd = (1 << 8) | SEEK_STAT | WRERR_STAT;

ide_state->status = SEEK_STAT | WRERR_STAT;

The 1 << 8 is covered by setting error=1 below already.

>     } else if (ide_state->drive_kind == IDE_CD) {
>         s->dev[port].port_regs.sig = SATA_SIGNATURE_CDROM;
>         ide_state->lcyl = 0x14;
> @@ -1100,7 +1098,6 @@ static void process_ncq_command(AHCIState *s,
> int port, uint8_t *cmd_fis,
> static int handle_cmd(AHCIState *s, int port, int slot)
> {
>     IDEState *ide_state;
> -    AHCIPortRegs *pr;

Yup.

>     uint32_t opts;
>     uint64_t tbl_addr;
>     AHCICmdHdr *cmd;
> @@ -1113,7 +1110,6 @@ static int handle_cmd(AHCIState *s, int port, int slot)
>         return -1;
>     }
> 
> -    pr = &s->dev[port].port_regs;

Yup.


Alex

Patch

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8ae236a..c12cc7f 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -807,7 +807,6 @@  static void ahci_reset_port(AHCIState *s, int port)
     AHCIPortRegs *pr = &d->port_regs;
     IDEState *ide_state = &d->port.ifs[0];
     uint8_t init_fis[0x20];
-    uint32_t tfd;
     int i;

     DPRINTF(port, "reset port\n");
@@ -848,7 +847,6 @@  static void ahci_reset_port(AHCIState *s, int port)
     s->dev[port].port_state = STATE_RUN;
     if (!ide_state->bs) {
         s->dev[port].port_regs.sig = 0;
-        tfd = (1 << 8) | SEEK_STAT | WRERR_STAT;
     } else if (ide_state->drive_kind == IDE_CD) {
         s->dev[port].port_regs.sig = SATA_SIGNATURE_CDROM;
         ide_state->lcyl = 0x14;
@@ -1100,7 +1098,6 @@  static void process_ncq_command(AHCIState *s,
int port, uint8_t *cmd_fis,
 static int handle_cmd(AHCIState *s, int port, int slot)
 {
     IDEState *ide_state;
-    AHCIPortRegs *pr;
     uint32_t opts;
     uint64_t tbl_addr;