Skip to content

Commit 1e3c3a7

Browse files
ij-intelgroeck
authored andcommitted
hwmon: (vt8231) Do PCI error checks on own line
Instead of if conditions with line splits, use the usual error handling pattern with a separate variable to improve readability. No functional changes intended. Signed-off-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 70332ec commit 1e3c3a7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/hwmon/vt8231.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -971,13 +971,15 @@ static int vt8231_pci_probe(struct pci_dev *dev,
971971
const struct pci_device_id *id)
972972
{
973973
u16 address, val;
974+
int ret;
975+
974976
if (force_addr) {
975977
address = force_addr & 0xff00;
976978
dev_warn(&dev->dev, "Forcing ISA address 0x%x\n",
977979
address);
978980

979-
if (PCIBIOS_SUCCESSFUL !=
980-
pci_write_config_word(dev, VT8231_BASE_REG, address | 1))
981+
ret = pci_write_config_word(dev, VT8231_BASE_REG, address | 1);
982+
if (ret != PCIBIOS_SUCCESSFUL)
981983
return -ENODEV;
982984
}
983985

@@ -997,9 +999,8 @@ static int vt8231_pci_probe(struct pci_dev *dev,
997999

9981000
if (!(val & 0x0001)) {
9991001
dev_warn(&dev->dev, "enabling sensors\n");
1000-
if (PCIBIOS_SUCCESSFUL !=
1001-
pci_write_config_word(dev, VT8231_ENABLE_REG,
1002-
val | 0x0001))
1002+
ret = pci_write_config_word(dev, VT8231_ENABLE_REG, val | 0x1);
1003+
if (ret != PCIBIOS_SUCCESSFUL)
10031004
return -ENODEV;
10041005
}
10051006

0 commit comments

Comments
 (0)