From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752064AbdILTwV (ORCPT ); Tue, 12 Sep 2017 15:52:21 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34584 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078AbdILTwR (ORCPT ); Tue, 12 Sep 2017 15:52:17 -0400 X-Google-Smtp-Source: ADKCNb4d0GuwxSgLTI/hrqLxipo69cqNUtL0iMrRN7NxPLRGVEqvQ4MsPAyXSSBgwJDpmDqIa9SeeQ== Date: Tue, 12 Sep 2017 22:52:13 +0300 From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] proc: use do-while in name_to_int() Message-ID: <20170912195213.GB17730@avx2> References: <20170912194850.GA17730@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170912194850.GA17730@avx2> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gcc doesn't know that "len" is guaranteed to be >=1 by dcache and generates standard while-loop prologue duplicating loop condition. add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-27 (-27) function old new delta name_to_int 104 77 -27 Signed-off-by: Alexey Dobriyan --- fs/proc/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/proc/util.c +++ b/fs/proc/util.c @@ -8,7 +8,7 @@ unsigned name_to_int(const struct qstr *qstr) if (len > 1 && *name == '0') goto out; - while (len-- > 0) { + do { unsigned c = *name++ - '0'; if (c > 9) goto out; @@ -16,7 +16,7 @@ unsigned name_to_int(const struct qstr *qstr) goto out; n *= 10; n += c; - } + } while (--len > 0); return n; out: return ~0U;