diff options
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_core.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 8af4f619bba2..fc0b5a93e1de 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -727,20 +727,21 @@ static void aer_isr_one_error(struct pcie_device *p_device, | |||
727 | static int get_e_source(struct aer_rpc *rpc, struct aer_err_source *e_src) | 727 | static int get_e_source(struct aer_rpc *rpc, struct aer_err_source *e_src) |
728 | { | 728 | { |
729 | unsigned long flags; | 729 | unsigned long flags; |
730 | int ret = 0; | ||
731 | 730 | ||
732 | /* Lock access to Root error producer/consumer index */ | 731 | /* Lock access to Root error producer/consumer index */ |
733 | spin_lock_irqsave(&rpc->e_lock, flags); | 732 | spin_lock_irqsave(&rpc->e_lock, flags); |
734 | if (rpc->prod_idx != rpc->cons_idx) { | 733 | if (rpc->prod_idx == rpc->cons_idx) { |
735 | *e_src = rpc->e_sources[rpc->cons_idx]; | 734 | spin_unlock_irqrestore(&rpc->e_lock, flags); |
736 | rpc->cons_idx++; | 735 | return 0; |
737 | if (rpc->cons_idx == AER_ERROR_SOURCES_MAX) | ||
738 | rpc->cons_idx = 0; | ||
739 | ret = 1; | ||
740 | } | 736 | } |
737 | |||
738 | *e_src = rpc->e_sources[rpc->cons_idx]; | ||
739 | rpc->cons_idx++; | ||
740 | if (rpc->cons_idx == AER_ERROR_SOURCES_MAX) | ||
741 | rpc->cons_idx = 0; | ||
741 | spin_unlock_irqrestore(&rpc->e_lock, flags); | 742 | spin_unlock_irqrestore(&rpc->e_lock, flags); |
742 | 743 | ||
743 | return ret; | 744 | return 1; |
744 | } | 745 | } |
745 | 746 | ||
746 | /** | 747 | /** |