staging: comedi: comedi_fops: Merge if conditions
PATCH v3 2/5 staging: comedi: comedi_fops: 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 v3:
-Removed extraneous parentheses.
Changes in v2:
-Merged Patch 2/6 and 3/6 of first version by not dropping if
conditions and only merging them for the same file.
drivers/staging/comedi/comedi_fops.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/staging/comedi/comedi_fops.c +3 -11
@@ -795,9 +795,7 @@ static int is_device_busy(struct comedi_device *dev)for (i =0 ; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; -if (s->busy) -return 1 ; -if (s->async &&comedi_buf_is_mmapped (s)) +if (s->busy || (s->async &&comedi_buf_is_mmapped (s)))return 1 ; }
@@ -2216,11 +2214,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) } size = vma->vm_end - vma->vm_start; -if (size > async->prealloc_bufsz) { - retval = -EFAULT ; - goto done; - } -if (size & (~PAGE_MASK )) { +if (size > async->prealloc_bufsz || size & (~PAGE_MASK )) { retval = -EFAULT ; goto done; }
@@ -2817,9 +2811,7 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) {unsigned int i; -if (!s) -return ; -if (s->minor <COMEDI_NUM_BOARD_MINORS || +if (!s || s->minor <COMEDI_NUM_BOARD_MINORS || s->minor >=COMEDI_NUM_MINORS )return ;
Signature · 1 line
1.9.1