diff mbox series

PCI: Fix handling of pci user accessor return codes in syscalls

Message ID f1220314-e518-1e18-bf94-8e6f8c703758@gmail.com (mailing list archive)
State Accepted
Commit e10c25b77c33a3c2bb699734edbfeedc9476bd74
Headers show
Series PCI: Fix handling of pci user accessor return codes in syscalls | expand

Commit Message

Heiner Kallweit Jan. 24, 2021, 3:39 p.m. UTC
Referenced commit changed the user accessors to return negative errno's
on error, seems this wasn't reflected in all users. Here it doesn't
really make a difference because the effective check is the same.

Fixes: 34e3207205ef ("PCI: handle positive error codes")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/pci/syscall.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Bjorn Helgaas Jan. 25, 2021, 7:57 p.m. UTC | #1
On Sun, Jan 24, 2021 at 04:39:32PM +0100, Heiner Kallweit wrote:
> Referenced commit changed the user accessors to return negative errno's
> on error, seems this wasn't reflected in all users. Here it doesn't
> really make a difference because the effective check is the same.
> 
> Fixes: 34e3207205ef ("PCI: handle positive error codes")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied to pci/misc for v5.11, thanks!

> ---
>  drivers/pci/syscall.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
> index 31e39558d..8b003c890 100644
> --- a/drivers/pci/syscall.c
> +++ b/drivers/pci/syscall.c
> @@ -20,7 +20,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
>  	u16 word;
>  	u32 dword;
>  	long err;
> -	long cfg_ret;
> +	int cfg_ret;
>  
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
> @@ -46,7 +46,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
>  	}
>  
>  	err = -EIO;
> -	if (cfg_ret != PCIBIOS_SUCCESSFUL)
> +	if (cfg_ret)
>  		goto error;
>  
>  	switch (len) {
> @@ -105,7 +105,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
>  		if (err)
>  			break;
>  		err = pci_user_write_config_byte(dev, off, byte);
> -		if (err != PCIBIOS_SUCCESSFUL)
> +		if (err)
>  			err = -EIO;
>  		break;
>  
> @@ -114,7 +114,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
>  		if (err)
>  			break;
>  		err = pci_user_write_config_word(dev, off, word);
> -		if (err != PCIBIOS_SUCCESSFUL)
> +		if (err)
>  			err = -EIO;
>  		break;
>  
> @@ -123,7 +123,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
>  		if (err)
>  			break;
>  		err = pci_user_write_config_dword(dev, off, dword);
> -		if (err != PCIBIOS_SUCCESSFUL)
> +		if (err)
>  			err = -EIO;
>  		break;
>  
> -- 
> 2.30.0
>
diff mbox series

Patch

diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index 31e39558d..8b003c890 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -20,7 +20,7 @@  SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
 	u16 word;
 	u32 dword;
 	long err;
-	long cfg_ret;
+	int cfg_ret;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -46,7 +46,7 @@  SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
 	}
 
 	err = -EIO;
-	if (cfg_ret != PCIBIOS_SUCCESSFUL)
+	if (cfg_ret)
 		goto error;
 
 	switch (len) {
@@ -105,7 +105,7 @@  SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 		if (err)
 			break;
 		err = pci_user_write_config_byte(dev, off, byte);
-		if (err != PCIBIOS_SUCCESSFUL)
+		if (err)
 			err = -EIO;
 		break;
 
@@ -114,7 +114,7 @@  SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 		if (err)
 			break;
 		err = pci_user_write_config_word(dev, off, word);
-		if (err != PCIBIOS_SUCCESSFUL)
+		if (err)
 			err = -EIO;
 		break;
 
@@ -123,7 +123,7 @@  SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 		if (err)
 			break;
 		err = pci_user_write_config_dword(dev, off, dword);
-		if (err != PCIBIOS_SUCCESSFUL)
+		if (err)
 			err = -EIO;
 		break;