diff options
author | Jean Delvare <jdelvare@suse.de> | 2016-02-18 15:50:45 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-09 00:48:56 +0300 |
commit | 20ac75e563d09f56fb00caa25a3afdb88573472d (patch) | |
tree | d120ec3d1779132a8bb0b085943e7b150f98cbc4 /drivers/pci/pcie | |
parent | 0e6053dc6e7a42c8ba9ce6e81adb3350c7df4bc8 (diff) | |
download | linux-20ac75e563d09f56fb00caa25a3afdb88573472d.tar.xz |
PCI/AER: Fix aer_inject error codes
EPERM means "Operation not permitted", which doesn't reflect the lack of
support for AER. EPROTONOSUPPORT (Protocol not supported) is a better
choice of error code if the device or its root port lack support for AER.
Likewise, EINVAL means "Invalid argument", which is not suitable for cases
where the AER error device is missing or unusable. ENODEV and
EPROTONOSUPPORT, respectively, fit better.
Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Borislav Petkov <bp@suse.de>
CC: Prarit Bhargava <prarit@redhat.com>
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r-- | drivers/pci/pcie/aer/aer_inject.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index e2760a39a98a..90bc3a6848a1 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c @@ -363,7 +363,7 @@ static int aer_inject(struct aer_error_inj *einj) pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); if (!pos_cap_err) { - ret = -EPERM; + ret = -EPROTONOSUPPORT; goto out_put; } pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_SEVER, &sever); @@ -373,7 +373,7 @@ static int aer_inject(struct aer_error_inj *einj) rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR); if (!rp_pos_cap_err) { - ret = -EPERM; + ret = -EPROTONOSUPPORT; goto out_put; } @@ -481,12 +481,12 @@ static int aer_inject(struct aer_error_inj *einj) if (find_aer_device(rpdev, &edev)) { if (!get_service_data(edev)) { printk(KERN_WARNING "AER service is not initialized\n"); - ret = -EINVAL; + ret = -EPROTONOSUPPORT; goto out_put; } aer_irq(-1, edev); } else - ret = -EINVAL; + ret = -ENODEV; out_put: kfree(err_alloc); kfree(rperr_alloc); |