aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2010-04-15 00:14:17 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-05-11 15:01:15 -0400
commit4a0c096efd4383fc98aa40e195363f600ba814f8 (patch)
tree61f7f4aa18e7905b227f2de3622dd43403fc0551 /drivers/pci/pcie
parentbd17d4742d5a8cbedd41a1d44c0cdee84a532363 (diff)
PCI: aerdrv: rework add_error_device
Stop iteration if we cannot register any more. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index f8ffa47503b7..f5eb69f532e7 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -99,18 +99,21 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
99} 99}
100EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); 100EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
101 101
102/**
103 * add_error_device - list device to be handled
104 * @e_info: pointer to error info
105 * @dev: pointer to pci_dev to be added
106 */
102static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev) 107static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev)
103{ 108{
104 if (e_info->error_dev_num < AER_MAX_MULTI_ERR_DEVICES) { 109 if (e_info->error_dev_num < AER_MAX_MULTI_ERR_DEVICES) {
105 e_info->dev[e_info->error_dev_num] = dev; 110 e_info->dev[e_info->error_dev_num] = dev;
106 e_info->error_dev_num++; 111 e_info->error_dev_num++;
107 return 1; 112 return 0;
108 } 113 }
109 114 return -ENOSPC;
110 return 0;
111} 115}
112 116
113
114#define PCI_BUS(x) (((x) >> 8) & 0xff) 117#define PCI_BUS(x) (((x) >> 8) & 0xff)
115 118
116/** 119/**
@@ -183,7 +186,12 @@ static int find_device_iter(struct pci_dev *dev, void *data)
183 struct aer_err_info *e_info = (struct aer_err_info *)data; 186 struct aer_err_info *e_info = (struct aer_err_info *)data;
184 187
185 if (is_error_source(dev, e_info)) { 188 if (is_error_source(dev, e_info)) {
186 add_error_device(e_info, dev); 189 /* List this device */
190 if (add_error_device(e_info, dev)) {
191 /* We cannot handle more... Stop iteration */
192 /* TODO: Should print error message here? */
193 return 1;
194 }
187 195
188 /* If there is only a single error, stop iteration */ 196 /* If there is only a single error, stop iteration */
189 if (!e_info->multi_error_valid) 197 if (!e_info->multi_error_valid)