PCI aerdrv: fix annoying warnings
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 27 May 2010 02:21:11 +0000 (11:21 +0900)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 30 Jul 2010 16:29:10 +0000 (09:29 -0700)
Some compiler generates following warnings:

  In function 'aer_isr':
  warning: 'e_src.id' may be used uninitialized in this function
  warning: 'e_src.status' may be used uninitialized in this function

Avoid status flag "int ret" and return constants instead, so that
gcc sees the return value matching "it is initialized" better.

Acked-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pcie/aer/aerdrv_core.c

index 8af4f619bba2ceb8871e4b34674ab0678c988c4b..fc0b5a93e1deaf3895ef671ae1f30892980c9352 100644 (file)
@@ -727,20 +727,21 @@ static void aer_isr_one_error(struct pcie_device *p_device,
 static int get_e_source(struct aer_rpc *rpc, struct aer_err_source *e_src)
 {
        unsigned long flags;
-       int ret = 0;
 
        /* Lock access to Root error producer/consumer index */
        spin_lock_irqsave(&rpc->e_lock, flags);
-       if (rpc->prod_idx != rpc->cons_idx) {
-               *e_src = rpc->e_sources[rpc->cons_idx];
-               rpc->cons_idx++;
-               if (rpc->cons_idx == AER_ERROR_SOURCES_MAX)
-                       rpc->cons_idx = 0;
-               ret = 1;
+       if (rpc->prod_idx == rpc->cons_idx) {
+               spin_unlock_irqrestore(&rpc->e_lock, flags);
+               return 0;
        }
+
+       *e_src = rpc->e_sources[rpc->cons_idx];
+       rpc->cons_idx++;
+       if (rpc->cons_idx == AER_ERROR_SOURCES_MAX)
+               rpc->cons_idx = 0;
        spin_unlock_irqrestore(&rpc->e_lock, flags);
 
-       return ret;
+       return 1;
 }
 
 /**