staging: comedi: range: Merge if conditions
PATCH 4/6 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>
--- 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
Quoted 36 lines · Amitoj Kaur Chawla
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]>--- drivers/staging/comedi/range.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/comedi/range.c +0
-0
drivers/staging/comedi/range.c int do_rangeinfo_ioctl(struct comedi_device *dev, · line 70
Quoted 7 lines
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))
You don´t need the parentheses.
julia
Quoted 13 lines
drivers/staging/comedi/range.c +0
-1return -EINVAL ; s = &dev->subdevices[subd];if (s->range_table) { --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160210085928.GA14628%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.