Skip to content

Commit 70332ec

Browse files
ij-intelgroeck
authored andcommitted
hwmon: (via686a) 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 e7593bd commit 70332ec

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/hwmon/via686a.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -855,16 +855,17 @@ static int via686a_pci_probe(struct pci_dev *dev,
855855
const struct pci_device_id *id)
856856
{
857857
u16 address, val;
858+
int ret;
858859

859860
if (force_addr) {
860861
address = force_addr & ~(VIA686A_EXTENT - 1);
861862
dev_warn(&dev->dev, "Forcing ISA address 0x%x\n", address);
862-
if (PCIBIOS_SUCCESSFUL !=
863-
pci_write_config_word(dev, VIA686A_BASE_REG, address | 1))
863+
ret = pci_write_config_word(dev, VIA686A_BASE_REG, address | 1);
864+
if (ret != PCIBIOS_SUCCESSFUL)
864865
return -ENODEV;
865866
}
866-
if (PCIBIOS_SUCCESSFUL !=
867-
pci_read_config_word(dev, VIA686A_BASE_REG, &val))
867+
ret = pci_read_config_word(dev, VIA686A_BASE_REG, &val);
868+
if (ret != PCIBIOS_SUCCESSFUL)
868869
return -ENODEV;
869870

870871
address = val & ~(VIA686A_EXTENT - 1);
@@ -874,8 +875,8 @@ static int via686a_pci_probe(struct pci_dev *dev,
874875
return -ENODEV;
875876
}
876877

877-
if (PCIBIOS_SUCCESSFUL !=
878-
pci_read_config_word(dev, VIA686A_ENABLE_REG, &val))
878+
ret = pci_read_config_word(dev, VIA686A_ENABLE_REG, &val);
879+
if (ret != PCIBIOS_SUCCESSFUL)
879880
return -ENODEV;
880881
if (!(val & 0x0001)) {
881882
if (!force_addr) {
@@ -886,9 +887,8 @@ static int via686a_pci_probe(struct pci_dev *dev,
886887
}
887888

888889
dev_warn(&dev->dev, "Enabling sensors\n");
889-
if (PCIBIOS_SUCCESSFUL !=
890-
pci_write_config_word(dev, VIA686A_ENABLE_REG,
891-
val | 0x0001))
890+
ret = pci_write_config_word(dev, VIA686A_ENABLE_REG, val | 0x1);
891+
if (ret != PCIBIOS_SUCCESSFUL)
892892
return -ENODEV;
893893
}
894894

0 commit comments

Comments
 (0)