Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572331

[PATCH 1/2] scatterlist: reorder compound boolean expression

From Gilad Ben-Yossef <gilad@benyossef.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] scatterlist: reorder compound boolean expression
Date 2017-02-02 14:00 +0100
Message-ID <t6p9v-441-3@gated-at.bofh.it> (permalink)
References <t6p9v-441-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Test the cheaper boolean expression with no side effects first.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
 lib/scatterlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 004fc70..393920f 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -666,7 +666,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
 
 	local_irq_save(flags);
 
-	while (sg_miter_next(&miter) && offset < buflen) {
+	while ((offset < buflen) && sg_miter_next(&miter)) {
 		unsigned int len;
 
 		len = min(miter.length, buflen - offset);
-- 
2.1.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/2] scatterlist: reorder compound boolean expression Gilad Ben-Yossef <gilad@benyossef.com> - 2017-02-02 14:00 +0100

csiph-web