summaryrefslogtreecommitdiff
path: root/drivers/hwmon/vt8231.c
diff options
context:
space:
mode:
authorSaheed O. Bolarinwa <refactormyself@gmail.com>2020-08-01 14:24:39 +0300
committerGuenter Roeck <linux@roeck-us.net>2020-08-05 00:24:39 +0300
commit2207515db60a6885e11069251d4f4ca4bf3abb6b (patch)
treed0c8d76b97ee1bf5606fb94a8b72b549c2b60f92 /drivers/hwmon/vt8231.c
parent2fdf8f7f086712bbe296d1d4d4049ca88e7a662d (diff)
downloadlinux-2207515db60a6885e11069251d4f4ca4bf3abb6b.tar.xz
hwmon: (i5k_amb, vt8231) Drop uses of pci_read_config_*() return value
The return value of pci_read_config_*() may not indicate a device error. However, the value read by these functions is more likely to indicate this kind of error. This presents two overlapping ways of reporting errors and complicates error checking. It is possible to move to one single way of checking for error if the dependency on the return value of these functions is removed, then it can later be made to return void. Remove all uses of the return value of pci_read_config_*(). Check the actual value read for ~0. In this case, ~0 is an invalid value thus it indicates some kind of error. Suggested-by: Bjorn Helgaas <bjorn@helgaas.com> Signed-off-by: Saheed O. Bolarinwa <refactormyself@gmail.com> Link: https://lore.kernel.org/r/20200801112446.149549-11-refactormyself@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/vt8231.c')
-rw-r--r--drivers/hwmon/vt8231.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 2335d440f72d..6603727e15a0 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -992,8 +992,8 @@ static int vt8231_pci_probe(struct pci_dev *dev,
return -ENODEV;
}
- if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_BASE_REG,
- &val))
+ pci_read_config_word(dev, VT8231_BASE_REG, &val);
+ if (val == (u16)~0)
return -ENODEV;
address = val & ~(VT8231_EXTENT - 1);
@@ -1002,8 +1002,8 @@ static int vt8231_pci_probe(struct pci_dev *dev,
return -ENODEV;
}
- if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_ENABLE_REG,
- &val))
+ pci_read_config_word(dev, VT8231_ENABLE_REG, &val);
+ if (val == (u16)~0)
return -ENODEV;
if (!(val & 0x0001)) {