Skip to content

Commit 4ce8738

Browse files
hkallweitgregkh
authored andcommitted
PCI: Align checking of syscall user config accessors
[ Upstream commit ef9e400 ] After 34e3207 ("PCI: handle positive error codes"), pci_user_read_config_*() and pci_user_write_config_*() return 0 or negative errno values, not PCIBIOS_* values like PCIBIOS_SUCCESSFUL or PCIBIOS_BAD_REGISTER_NUMBER. Remove comparisons with PCIBIOS_SUCCESSFUL and check only for non-zero. It happens that PCIBIOS_SUCCESSFUL is zero, so this is not a functional change, but it aligns this code with the user accessors. [bhelgaas: commit log] Fixes: 34e3207 ("PCI: handle positive error codes") Link: https://lore.kernel.org/r/f1220314-e518-1e18-bf94-8e6f8c703758@gmail.com Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6b34aa5 commit 4ce8738

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎drivers/pci/syscall.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
2020
u16 word;
2121
u32 dword;
2222
long err;
23-
long cfg_ret;
23+
int cfg_ret;
2424

2525
if (!capable(CAP_SYS_ADMIN))
2626
return -EPERM;
@@ -46,7 +46,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
4646
}
4747

4848
err = -EIO;
49-
if (cfg_ret != PCIBIOS_SUCCESSFUL)
49+
if (cfg_ret)
5050
goto error;
5151

5252
switch (len) {
@@ -105,7 +105,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
105105
if (err)
106106
break;
107107
err = pci_user_write_config_byte(dev, off, byte);
108-
if (err != PCIBIOS_SUCCESSFUL)
108+
if (err)
109109
err = -EIO;
110110
break;
111111

@@ -114,7 +114,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
114114
if (err)
115115
break;
116116
err = pci_user_write_config_word(dev, off, word);
117-
if (err != PCIBIOS_SUCCESSFUL)
117+
if (err)
118118
err = -EIO;
119119
break;
120120

@@ -123,7 +123,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
123123
if (err)
124124
break;
125125
err = pci_user_write_config_dword(dev, off, dword);
126-
if (err != PCIBIOS_SUCCESSFUL)
126+
if (err)
127127
err = -EIO;
128128
break;
129129

0 commit comments

Comments
 (0)