From: Gilad Ben-Yossef Date: Mon, 27 Feb 2017 22:28:27 +0000 (-0800) Subject: scatterlist: reorder compound boolean expression X-Git-Tag: Ubuntu-5.2.0-15.16~7351^2~42 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1d5210ef706523529d3cc16fd70be0a466253466;p=mirror_ubuntu-eoan-kernel.git 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 --- 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);