Skip to contentSkip to conversation

staging: comedi: drivers: comedi_8254: Merge if conditions

PATCH In review Amitoj Kaur Chawla 1 participant 1 message Feb 11, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/5 staging: comedi: drivers: comedi_8254: Merge if conditions

Merge if conditions with the same statements.

Found using Coccinelle. The semantic patch used to find this is as follows:

//<smpl>
@@
statement S;
expression e,x;
@@

* if(e)
(
{ ... return ...; }
&
S
)

* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>

---
Changes in v3:
-Removed extraneous parentheses.
Changes in v2:
-Merged if conditions instead of dropping them.

 drivers/staging/comedi/drivers/comedi_8254.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/comedi/drivers/comedi_8254.c +1 -3
index 0d5d56b..c5b643e 100644
@@ -241,9 +241,7 @@ void comedi_8254_write(struct comedi_8254 *i8254,
 {
 	unsigned int byte;
 
-	if (counter > 2)
-		return;
-	if (val > 0xffff)
+	if (counter > 2 || val > 0xffff)
 		return;
 
 	/* load LSB then MSB */
Signature · 1 line
1.9.1