[Linux-kernel-mentees] [RFC PATCH 20/35] atm: Tidy Success/Failure checks

Saheed O. Bolarinwa refactormyself at gmail.com
Mon Jul 13 12:22:32 UTC 2020


Remove unnecessary check for 0.

Signed-off-by: "Saheed O. Bolarinwa" <refactormyself at gmail.com>
---
This patch depends on PATCH 19/35

 drivers/atm/iphase.c | 10 ++++------
 drivers/atm/lanai.c  |  6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index b01cc491540d..2c75b82b4e7f 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2295,14 +2295,12 @@ static int reset_sar(struct atm_dev *dev)
 	  
 	iadev = INPH_IA_DEV(dev);  
 	for(i=0; i<64; i++)  
-	  if ((error = pci_read_config_dword(iadev->pci,  
-				i*4, &pci[i])) != 0)
-  	      return error;  
+		if ((error = pci_read_config_dword(iadev->pci, i*4, &pci[i])))
+			return error;
 	writel(0, iadev->reg+IPHASE5575_EXT_RESET);  
 	for(i=0; i<64; i++)  
-	  if ((error = pci_write_config_dword(iadev->pci,  
-					i*4, pci[i])) != 0)
-	    return error;  
+		if ((error = pci_write_config_dword(iadev->pci, i*4, pci[i])))
+			return error;
 	udelay(5);  
 	return 0;  
 }  
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 2b82ae30dd74..5852b8cc0cc4 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -1098,7 +1098,7 @@ static void pcistatus_check(struct lanai_dev *lanai, int clearonly)
 	u16 s;
 	int result;
 	result = pci_read_config_word(lanai->pci, PCI_STATUS, &s);
-	if (result != 0) {
+	if (result) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't read PCI_STATUS: "
 		    "%d\n", lanai->number, result);
 		return;
@@ -1109,7 +1109,7 @@ static void pcistatus_check(struct lanai_dev *lanai, int clearonly)
 	if (s == 0)
 		return;
 	result = pci_write_config_word(lanai->pci, PCI_STATUS, s);
-	if (result != 0)
+	if (result)
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't write PCI_STATUS: "
 		    "%d\n", lanai->number, result);
 	if (clearonly)
@@ -1945,7 +1945,7 @@ static int lanai_pci_start(struct lanai_dev *lanai)
 		return -EBUSY;
 	}
 	result = check_board_id_and_rev("PCI", pci->subsystem_device, NULL);
-	if (result != 0)
+	if (result)
 		return result;
 	/* Set latency timer to zero as per lanai docs */
 	result = pci_write_config_byte(pci, PCI_LATENCY_TIMER, 0);
-- 
2.18.2



More information about the Linux-kernel-mentees mailing list