All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: comedi: Optimize code using logical short-circuiting
@ 2016-09-16 19:24 Namrata A Shettar
  2016-09-17 18:35 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Namrata A Shettar @ 2016-09-16 19:24 UTC (permalink / raw)
  To: outreachy-kernel, Ian Abbott, H Hartley Sweeten,
	Greg Kroah-Hartman, Leslie Klein

Optimize code using logical short-circuiting. Two if statements
having same return value is equivalent to a single if statement with
condition being the union of the prior two.

Signed-off-by: Namrata A Shettar <namrataashettar@gmail.com>
---
 drivers/staging/comedi/comedi_fops.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 1999eed..0d69ed7 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -791,9 +791,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;
 	}
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-18  4:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-16 19:24 [PATCH] staging: comedi: Optimize code using logical short-circuiting Namrata A Shettar
2016-09-17 18:35 ` Greg Kroah-Hartman
2016-09-18  4:44   ` Namrata A Shettar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.