pci, aer_inject fix return values when device not found

Submitted by Prarit Bhargava on March 20, 2013, 10:04 p.m.

Details

Message ID 1363817083-2807-1-git-send-email-prarit@redhat.com
State Accepted
Headers show

Commit Message

Prarit Bhargava March 20, 2013, 10:04 p.m.
Currently the aer_inject driver returns -ENOTTY when the target PCIE device
root port is not found or if the device or root port doesn't support AER.

In the case where the root port isn't found, the driver should return -ENODEV,
and in the other cases it should return -EPERM.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/pci/pcie/aer/aer_inject.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bjorn Helgaas April 3, 2013, 11:15 p.m.
On Wed, Mar 20, 2013 at 4:04 PM, Prarit Bhargava <prarit@redhat.com> wrote:
> Currently the aer_inject driver returns -ENOTTY when the target PCIE device
> root port is not found or if the device or root port doesn't support AER.
>
> In the case where the root port isn't found, the driver should return -ENODEV,
> and in the other cases it should return -EPERM.
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>

Applied for v3.10, thanks.

Ben, chime in if you have any input about errno usage :)

> ---
>  drivers/pci/pcie/aer/aer_inject.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
> index 4e24cb8..8d4a5e3 100644
> --- a/drivers/pci/pcie/aer/aer_inject.c
> +++ b/drivers/pci/pcie/aer/aer_inject.c
> @@ -334,13 +334,13 @@ static int aer_inject(struct aer_error_inj *einj)
>                 return -ENODEV;
>         rpdev = pcie_find_root_port(dev);
>         if (!rpdev) {
> -               ret = -ENOTTY;
> +               ret = -ENODEV;
>                 goto out_put;
>         }
>
>         pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
>         if (!pos_cap_err) {
> -               ret = -ENOTTY;
> +               ret = -EPERM;
>                 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_inj *einj)
>
>         rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR);
>         if (!rp_pos_cap_err) {
> -               ret = -ENOTTY;
> +               ret = -EPERM;
>                 goto out_put;
>         }
>
> --
> 1.7.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index 4e24cb8..8d4a5e3 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -334,13 +334,13 @@  static int aer_inject(struct aer_error_inj *einj)
 		return -ENODEV;
 	rpdev = pcie_find_root_port(dev);
 	if (!rpdev) {
-		ret = -ENOTTY;
+		ret = -ENODEV;
 		goto out_put;
 	}
 
 	pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
 	if (!pos_cap_err) {
-		ret = -ENOTTY;
+		ret = -EPERM;
 		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_inj *einj)
 
 	rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR);
 	if (!rp_pos_cap_err) {
-		ret = -ENOTTY;
+		ret = -EPERM;
 		goto out_put;
 	}