linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix handling of pci user accessor return codes in syscalls
@ 2021-01-24 15:39 Heiner Kallweit
  2021-01-25 19:57 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2021-01-24 15:39 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

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(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: Fix handling of pci user accessor return codes in syscalls
  2021-01-24 15:39 [PATCH] PCI: Fix handling of pci user accessor return codes in syscalls Heiner Kallweit
@ 2021-01-25 19:57 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2021-01-25 19:57 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Bjorn Helgaas, linux-pci

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-25 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24 15:39 [PATCH] PCI: Fix handling of pci user accessor return codes in syscalls Heiner Kallweit
2021-01-25 19:57 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).