[PATCH 1/4] PCI: aer_inject: Fix error codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



EPERM means "Operation not permitted", which doesn't reflect the lack
of support for AER. EPROTONOSUPPORT (Protocol not supported) is a
better choice or 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@xxxxxxx>
Signed-off-by: Jean Delvare <jdelvare@xxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxx>
Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Cc: Prarit Bhargava <prarit@xxxxxxxxxx>
---
 drivers/pci/pcie/aer/aer_inject.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-4.5-rc4.orig/drivers/pci/pcie/aer/aer_inject.c	2016-02-18 11:23:03.741503472 +0100
+++ linux-4.5-rc4/drivers/pci/pcie/aer/aer_inject.c	2016-02-18 13:18:18.999397788 +0100
@@ -340,7 +340,7 @@ static int aer_inject(struct aer_error_i
 
 	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);
@@ -350,7 +350,7 @@ static int aer_inject(struct aer_error_i
 
 	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;
 	}
 
@@ -458,12 +458,12 @@ static int aer_inject(struct aer_error_i
 	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);

-- 
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux