From patchwork Thu Feb 2 12:55:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 93102 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp84355qgi; Thu, 2 Feb 2017 04:56:10 -0800 (PST) X-Received: by 10.99.175.16 with SMTP id w16mr10643662pge.32.1486040170079; Thu, 02 Feb 2017 04:56:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si22205400plm.193.2017.02.02.04.56.09; Thu, 02 Feb 2017 04:56:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbdBBM4D (ORCPT + 25 others); Thu, 2 Feb 2017 07:56:03 -0500 Received: from foss.arm.com ([217.140.101.70]:56628 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750808AbdBBM4B (ORCPT ); Thu, 2 Feb 2017 07:56:01 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B20F0152B; Thu, 2 Feb 2017 04:56:00 -0800 (PST) Received: from gby.kfn.arm.com (unknown [10.45.48.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C6EE33F242; Thu, 2 Feb 2017 04:55:59 -0800 (PST) From: Gilad Ben-Yossef To: linux-kernel@vger.kernel.org Cc: gilad.benyossef@arm.com, ofir.drang@arm.com Subject: [PATCH 1/2] scatterlist: reorder compound boolean expression Date: Thu, 2 Feb 2017 14:55:49 +0200 Message-Id: <1486040150-14109-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1486040150-14109-1-git-send-email-gilad@benyossef.com> References: <1486040150-14109-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Test the cheaper boolean expression with no side effects first. Signed-off-by: Gilad Ben-Yossef --- lib/scatterlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 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);