PCI: use better error return values in aer_inject

Replaced some error return values in aer_inject. Use -ENODEV when we
can't find a device and -ENOTTY when the device does not support PCIe AER.

Acked-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Andrew Patterson 2009-10-12 13:14:10 -06:00 коммит произвёл Jesse Barnes
Родитель cc5d153a0c
Коммит 1d02435594
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -326,23 +326,23 @@ static int aer_inject(struct aer_error_inj *einj)
dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn); dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn);
if (!dev) if (!dev)
return -EINVAL; return -ENODEV;
rpdev = pcie_find_root_port(dev); rpdev = pcie_find_root_port(dev);
if (!rpdev) { if (!rpdev) {
ret = -EINVAL; ret = -ENOTTY;
goto out_put; goto out_put;
} }
pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
if (!pos_cap_err) { if (!pos_cap_err) {
ret = -EIO; ret = -ENOTTY;
goto out_put; goto out_put;
} }
pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_SEVER, &sever); pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_SEVER, &sever);
rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR); rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR);
if (!rp_pos_cap_err) { if (!rp_pos_cap_err) {
ret = -EIO; ret = -ENOTTY;
goto out_put; goto out_put;
} }