staging: comedi: range: Merge if conditions
PATCH v2 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>
Signed-off-by Amitoj Kaur Chawla <[email protected]>
---
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
@@ -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