From 1d5210ef706523529d3cc16fd70be0a466253466 Mon Sep 17 00:00:00 2001 From: Gilad Ben-Yossef Date: Mon, 27 Feb 2017 14:28:27 -0800 Subject: scatterlist: reorder compound boolean expression Test the cheaper boolean expression with no side effects first. Link: http://lkml.kernel.org/r/1486040150-14109-2-git-send-email-gilad@benyossef.com Signed-off-by: Gilad Ben-Yossef Cc: Jens Axboe Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/scatterlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 004fc70fc56a..393920fddcb9 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); -- cgit v1.2.3