Skip to contentSkip to conversation

staging: comedi: range: 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 3/5 staging: comedi: range: 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:
-None
Changes in v2:
-Remove extraneous parentheses added in first version.

 drivers/staging/comedi/range.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/comedi/range.c +1 -3
index ce3a58a..4eff819 100644
@@ -67,9 +67,7 @@ int do_rangeinfo_ioctl(struct comedi_device *dev,
 	subd = (it.range_type >> 24) & 0xf;
 	chan = (it.range_type >> 16) & 0xff;
 
-	if (!dev->attached)
-		return -EINVAL;
-	if (subd >= dev->n_subdevices)
+	if (!dev->attached || subd >= dev->n_subdevices)
 		return -EINVAL;
 	s = &dev->subdevices[subd];
 	if (s->range_table) {
Signature · 1 line
1.9.1