Patchwork [3/6] pci/aer: remove dead code

login
register
mail settings
Submitter Michael S. Tsirkin
Date Dec. 2, 2010, 10:54 p.m.
Message ID <c49529a5d8c554cb60278c5025f1a301a2ab19d6.1291330353.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/74038/
State New
Headers show

Comments

Michael S. Tsirkin - Dec. 2, 2010, 10:54 p.m.
Remove some unused variables and return values.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pcie_aer.c |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)
Isaku Yamahata - Dec. 7, 2010, 7:29 a.m.
The eventual result looks okay.
But if-clauses that surrounds msi_trigger = true should be eliminated
at the same time.
1/6, 3/6 and, 4/6 could be reordered for bisectability.

thanks,

On Fri, Dec 03, 2010 at 12:54:37AM +0200, Michael S. Tsirkin wrote:
> Remove some unused variables and return values.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/pcie_aer.c |   15 +--------------
>  1 files changed, 1 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
> index 18bbd5a..204155b 100644
> --- a/hw/pcie_aer.c
> +++ b/hw/pcie_aer.c
> @@ -258,29 +258,21 @@ static unsigned int pcie_aer_root_get_vector(PCIDevice *dev)
>  }
>  
>  /*
> - * return value:
> - * true: error message is sent up
> - * false: error message is masked
> - *
>   * 6.2.6 Error Message Control
>   * Figure 6-3
>   * root port part
>   */
> -static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
> +static void pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
>  {
> -    bool msg_sent;
>      uint16_t cmd;
>      uint8_t *aer_cap;
>      uint32_t root_cmd;
>      uint32_t root_status;
> -    bool msi_trigger;
>  
> -    msg_sent = false;
>      cmd = pci_get_word(dev->config + PCI_COMMAND);
>      aer_cap = dev->config + dev->exp.aer_cap;
>      root_cmd = pci_get_long(aer_cap + PCI_ERR_ROOT_COMMAND);
>      root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
> -    msi_trigger = false;
>  
>      if (cmd & PCI_COMMAND_SERR) {
>          /* System Error.
> @@ -300,7 +292,6 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
>              root_status |= PCI_ERR_ROOT_MULTI_COR_RCV;
>          } else {
>              if (root_cmd & PCI_ERR_ROOT_CMD_COR_EN) {
> -                msi_trigger = true;
>              }
>              pci_set_word(aer_cap + PCI_ERR_ROOT_COR_SRC, msg->source_id);
>          }
> @@ -309,14 +300,12 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
>      case PCI_ERR_ROOT_CMD_NONFATAL_EN:
>          if (!(root_status & PCI_ERR_ROOT_NONFATAL_RCV) &&
>              root_cmd & PCI_ERR_ROOT_CMD_NONFATAL_EN) {
> -            msi_trigger = true;
>          }
>          root_status |= PCI_ERR_ROOT_NONFATAL_RCV;
>          break;
>      case PCI_ERR_ROOT_CMD_FATAL_EN:
>          if (!(root_status & PCI_ERR_ROOT_FATAL_RCV) &&
>              root_cmd & PCI_ERR_ROOT_CMD_FATAL_EN) {
> -            msi_trigger = true;
>          }
>          if (!(root_status & PCI_ERR_ROOT_UNCOR_RCV)) {
>              root_status |= PCI_ERR_ROOT_FIRST_FATAL;
> @@ -346,9 +335,7 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
>          } else {
>              qemu_set_irq(dev->irq[dev->exp.aer_intx], 1);
>          }
> -        msg_sent = true;
>      }
> -    return msg_sent;
>  }
>  
>  /*
> -- 
> 1.7.3.2.91.g446ac
>

Patch

diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index 18bbd5a..204155b 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -258,29 +258,21 @@  static unsigned int pcie_aer_root_get_vector(PCIDevice *dev)
 }
 
 /*
- * return value:
- * true: error message is sent up
- * false: error message is masked
- *
  * 6.2.6 Error Message Control
  * Figure 6-3
  * root port part
  */
-static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
+static void pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
 {
-    bool msg_sent;
     uint16_t cmd;
     uint8_t *aer_cap;
     uint32_t root_cmd;
     uint32_t root_status;
-    bool msi_trigger;
 
-    msg_sent = false;
     cmd = pci_get_word(dev->config + PCI_COMMAND);
     aer_cap = dev->config + dev->exp.aer_cap;
     root_cmd = pci_get_long(aer_cap + PCI_ERR_ROOT_COMMAND);
     root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
-    msi_trigger = false;
 
     if (cmd & PCI_COMMAND_SERR) {
         /* System Error.
@@ -300,7 +292,6 @@  static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
             root_status |= PCI_ERR_ROOT_MULTI_COR_RCV;
         } else {
             if (root_cmd & PCI_ERR_ROOT_CMD_COR_EN) {
-                msi_trigger = true;
             }
             pci_set_word(aer_cap + PCI_ERR_ROOT_COR_SRC, msg->source_id);
         }
@@ -309,14 +300,12 @@  static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
     case PCI_ERR_ROOT_CMD_NONFATAL_EN:
         if (!(root_status & PCI_ERR_ROOT_NONFATAL_RCV) &&
             root_cmd & PCI_ERR_ROOT_CMD_NONFATAL_EN) {
-            msi_trigger = true;
         }
         root_status |= PCI_ERR_ROOT_NONFATAL_RCV;
         break;
     case PCI_ERR_ROOT_CMD_FATAL_EN:
         if (!(root_status & PCI_ERR_ROOT_FATAL_RCV) &&
             root_cmd & PCI_ERR_ROOT_CMD_FATAL_EN) {
-            msi_trigger = true;
         }
         if (!(root_status & PCI_ERR_ROOT_UNCOR_RCV)) {
             root_status |= PCI_ERR_ROOT_FIRST_FATAL;
@@ -346,9 +335,7 @@  static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
         } else {
             qemu_set_irq(dev->irq[dev->exp.aer_intx], 1);
         }
-        msg_sent = true;
     }
-    return msg_sent;
 }
 
 /*