[Linux-kernel-mentees] [RFC PATCH 17/35] hwmon: (sis5595) Tidy Success/Failure checks
From: Saheed O. Bolarinwa <hidden>
Date: 2020-07-13 13:23:11
Also in:
linux-hwmon, linux-pci, lkml
Subsystem:
hardware monitoring, the rest, vt8231 hardware monitor driver · Maintainers:
Guenter Roeck, Linus Torvalds, Roger Lucas
Remove unnecessary check for 0. Signed-off-by: "Saheed O. Bolarinwa" <redacted> --- This patch depends on PATCH 16/35 drivers/hwmon/sis5595.c | 13 ++++--------- drivers/hwmon/via686a.c | 13 ++++--------- drivers/hwmon/vt8231.c | 13 ++++--------- 3 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 0ea174fb3048..91fdddaa4136 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c@@ -825,8 +825,7 @@ static int sis5595_pci_probe(struct pci_dev *dev, pci_write_config_word(dev, SIS5595_BASE_REG, force_addr); } - if (0 != - pci_read_config_word(dev, SIS5595_BASE_REG, &address)) { + if (pci_read_config_word(dev, SIS5595_BASE_REG, &address)) { dev_err(&dev->dev, "Failed to read ISA address\n"); return -ENODEV; }
@@ -843,17 +842,13 @@ static int sis5595_pci_probe(struct pci_dev *dev, return -ENODEV; } - if (0 != - pci_read_config_byte(dev, SIS5595_ENABLE_REG, &enable)) { + if (pci_read_config_byte(dev, SIS5595_ENABLE_REG, &enable)) { dev_err(&dev->dev, "Failed to read enable register\n"); return -ENODEV; } if (!(enable & 0x80)) { - if ((0 != - pci_write_config_byte(dev, SIS5595_ENABLE_REG, - enable | 0x80)) - || (0 != - pci_read_config_byte(dev, SIS5595_ENABLE_REG, &enable)) + if ((pci_write_config_byte(dev, SIS5595_ENABLE_REG, enable | 0x80)) + || (pci_read_config_byte(dev, SIS5595_ENABLE_REG, &enable)) || (!(enable & 0x80))) { /* doesn't work for some chips! */ dev_err(&dev->dev, "Failed to enable HWM device\n");
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index cffea688878f..b8466e2e1435 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c@@ -863,12 +863,10 @@ static int via686a_pci_probe(struct pci_dev *dev, if (force_addr) { address = force_addr & ~(VIA686A_EXTENT - 1); dev_warn(&dev->dev, "Forcing ISA address 0x%x\n", address); - if (0 != - pci_write_config_word(dev, VIA686A_BASE_REG, address | 1)) + if (pci_write_config_word(dev, VIA686A_BASE_REG, address | 1)) return -ENODEV; } - if (0 != - pci_read_config_word(dev, VIA686A_BASE_REG, &val)) + if (pci_read_config_word(dev, VIA686A_BASE_REG, &val)) return -ENODEV; address = val & ~(VIA686A_EXTENT - 1);
@@ -878,8 +876,7 @@ static int via686a_pci_probe(struct pci_dev *dev, return -ENODEV; } - if (0 != - pci_read_config_word(dev, VIA686A_ENABLE_REG, &val)) + if (pci_read_config_word(dev, VIA686A_ENABLE_REG, &val)) return -ENODEV; if (!(val & 0x0001)) { if (!force_addr) {
@@ -890,9 +887,7 @@ static int via686a_pci_probe(struct pci_dev *dev, } dev_warn(&dev->dev, "Enabling sensors\n"); - if (0 != - pci_write_config_word(dev, VIA686A_ENABLE_REG, - val | 0x0001)) + if (pci_write_config_word(dev, VIA686A_ENABLE_REG, val | 0x0001)) return -ENODEV; }
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index cc1d24c2a2c8..ee6cd6b85f91 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c@@ -987,13 +987,11 @@ static int vt8231_pci_probe(struct pci_dev *dev, dev_warn(&dev->dev, "Forcing ISA address 0x%x\n", address); - if (0 != - pci_write_config_word(dev, VT8231_BASE_REG, address | 1)) + if (pci_write_config_word(dev, VT8231_BASE_REG, address | 1)) return -ENODEV; } - if (0 != pci_read_config_word(dev, VT8231_BASE_REG, - &val)) + if (pci_read_config_word(dev, VT8231_BASE_REG, &val)) return -ENODEV; address = val & ~(VT8231_EXTENT - 1);
@@ -1002,15 +1000,12 @@ static int vt8231_pci_probe(struct pci_dev *dev, return -ENODEV; } - if (0 != pci_read_config_word(dev, VT8231_ENABLE_REG, - &val)) + if (pci_read_config_word(dev, VT8231_ENABLE_REG, &val)) return -ENODEV; if (!(val & 0x0001)) { dev_warn(&dev->dev, "enabling sensors\n"); - if (0 != - pci_write_config_word(dev, VT8231_ENABLE_REG, - val | 0x0001)) + if (pci_write_config_word(dev, VT8231_ENABLE_REG, val | 0x0001)) return -ENODEV; }
--
2.18.2
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees