Skip to content

Commit

Permalink
hwmon: (vt8231) Do PCI error checks on own line
Browse files Browse the repository at this point in the history
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 <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230824132832.78705-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Ilpo Järvinen authored and Guenter Roeck committed Aug 25, 2023
1 parent 70332ec commit 1e3c3a7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/hwmon/vt8231.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,13 +971,15 @@ static int vt8231_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
u16 address, val;
int ret;

if (force_addr) {
address = force_addr & 0xff00;
dev_warn(&dev->dev, "Forcing ISA address 0x%x\n",
address);

if (PCIBIOS_SUCCESSFUL !=
pci_write_config_word(dev, VT8231_BASE_REG, address | 1))
ret = pci_write_config_word(dev, VT8231_BASE_REG, address | 1);
if (ret != PCIBIOS_SUCCESSFUL)
return -ENODEV;
}

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

if (!(val & 0x0001)) {
dev_warn(&dev->dev, "enabling sensors\n");
if (PCIBIOS_SUCCESSFUL !=
pci_write_config_word(dev, VT8231_ENABLE_REG,
val | 0x0001))
ret = pci_write_config_word(dev, VT8231_ENABLE_REG, val | 0x1);
if (ret != PCIBIOS_SUCCESSFUL)
return -ENODEV;
}

Expand Down

0 comments on commit 1e3c3a7

Please sign in to comment.