[Linux-kernel-mentees] [RFC PATCH 15/35] i2c/busses: Tidy Success/Failure checks
From: Saheed O. Bolarinwa <hidden>
Date: 2020-07-13 13:23:04
Also in:
linux-i2c, linux-pci, lkml
Subsystem:
i2c subsystem, i2c subsystem host drivers, i2c/smbus controller drivers for pc, the rest · Maintainers:
Andi Shyti, Jean Delvare, Linus Torvalds
Remove unnecessary check for 0. Signed-off-by: "Saheed O. Bolarinwa" <redacted> --- This patch depends on PATCH 15/35 drivers/i2c/busses/i2c-ali15x3.c | 5 ++--- drivers/i2c/busses/i2c-nforce2.c | 3 +-- drivers/i2c/busses/i2c-sis5595.c | 15 +++++---------- 3 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index 359ee3e0864a..c9e779cc184e 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c@@ -167,11 +167,10 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev) if(force_addr) { dev_info(&ALI15X3_dev->dev, "forcing ISA address 0x%04X\n", ali15x3_smba); - if (0 != pci_write_config_word(ALI15X3_dev, - SMBBA, + if (pci_write_config_word(ALI15X3_dev, SMBBA, ali15x3_smba)) goto error; - if (0 != pci_read_config_word(ALI15X3_dev, + if (pci_read_config_word(ALI15X3_dev, SMBBA, &a)) goto error; if ((a & ~(ALI15X3_SMB_IOSIZE - 1)) != ali15x3_smba) {
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 385f4f446f36..54d2985b7aaf 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c@@ -327,8 +327,7 @@ static int nforce2_probe_smb(struct pci_dev *dev, int bar, int alt_reg, /* Older incarnations of the device used non-standard BARs */ u16 iobase; - if (pci_read_config_word(dev, alt_reg, &iobase) - != 0) { + if (pci_read_config_word(dev, alt_reg, &iobase)) { dev_err(&dev->dev, "Error reading PCI config for %s\n", name); return -EIO;
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index fbe3ee31eae3..b016f48519d3 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c@@ -175,11 +175,9 @@ static int sis5595_setup(struct pci_dev *SIS5595_dev) if (force_addr) { dev_info(&SIS5595_dev->dev, "forcing ISA address 0x%04X\n", sis5595_base); - if (pci_write_config_word(SIS5595_dev, ACPI_BASE, sis5595_base) - != 0) + if (pci_write_config_word(SIS5595_dev, ACPI_BASE, sis5595_base)) goto error; - if (pci_read_config_word(SIS5595_dev, ACPI_BASE, &a) - != 0) + if (pci_read_config_word(SIS5595_dev, ACPI_BASE, &a)) goto error; if ((a & ~(SIS5595_EXTENT - 1)) != sis5595_base) { /* doesn't work for some chips! */
@@ -188,16 +186,13 @@ static int sis5595_setup(struct pci_dev *SIS5595_dev) } } - if (pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val) - != 0) + if (pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)) goto error; if ((val & 0x80) == 0) { dev_info(&SIS5595_dev->dev, "enabling ACPI\n"); - if (pci_write_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, val | 0x80) - != 0) + if (pci_write_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, val | 0x80)) goto error; - if (pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val) - != 0) + if (pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)) goto error; if ((val & 0x80) == 0) { /* doesn't work for some chips? */
--
2.18.2
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees