]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
scatterlist: reorder compound boolean expression
authorGilad Ben-Yossef <gilad@benyossef.com>
Mon, 27 Feb 2017 22:28:27 +0000 (14:28 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 28 Feb 2017 02:43:46 +0000 (18:43 -0800)
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 <gilad@benyossef.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: <ofir.drang@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/scatterlist.c

index 004fc70fc56a3d06947f9e89c60e40e272ce551c..393920fddcb99c3c1e2df19a0c8f9cceca148c46 100644 (file)
@@ -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);