diff mbox series

[1/2] scatterlist: reorder compound boolean expression

Message ID 1486040150-14109-2-git-send-email-gilad@benyossef.com
State Accepted
Commit 1d5210ef706523529d3cc16fd70be0a466253466
Headers show
Series scatterlist: clean up | expand

Commit Message

Gilad Ben-Yossef Feb. 2, 2017, 12:55 p.m. UTC
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(-)

-- 
2.1.4
diff mbox series

Patch

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);