From patchwork Thu Jul 27 20:53:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Guibouret X-Patchwork-Id: 794569 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xJPH86GhRz9ryk for ; Fri, 28 Jul 2017 06:49:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751518AbdG0Utk (ORCPT ); Thu, 27 Jul 2017 16:49:40 -0400 Received: from smtp4-g21.free.fr ([212.27.42.4]:2384 "EHLO smtp4-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbdG0Utj (ORCPT ); Thu, 27 Jul 2017 16:49:39 -0400 Received: from localhost.localdomain (unknown [82.230.26.21]) by smtp4-g21.free.fr (Postfix) with ESMTP id 551C119F59F; Thu, 27 Jul 2017 22:49:38 +0200 (CEST) From: Damien Guibouret To: linux-ext4@vger.kernel.org Cc: Damien Guibouret Subject: [PATCH] ext4/hash.c: remove useless test and assignment in strtohash Date: Thu, 27 Jul 2017 22:53:27 +0200 Message-Id: <1501188807-4459-1-git-send-email-damien.guibouret@partition-saving.com> X-Mailer: git-send-email 2.5.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On transformation of str to hash, computed value is initialised before first byte modulo 4. But it is already initialised before entering loop and after processing last byte modulo 4. So the corresponding test and initialisation could be removed. Signed-off-by: Damien Guibouret --- fs/ext4/hash.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c index 38b8a96..00c6dd2 100644 --- a/fs/ext4/hash.c +++ b/fs/ext4/hash.c @@ -148,8 +148,6 @@ static void str2hashbuf_signed(const char *msg, int len, __u32 *buf, int num) if (len > num*4) len = num * 4; for (i = 0; i < len; i++) { - if ((i % 4) == 0) - val = pad; val = ((int) scp[i]) + (val << 8); if ((i % 4) == 3) { *buf++ = val; @@ -176,8 +174,6 @@ static void str2hashbuf_unsigned(const char *msg, int len, __u32 *buf, int num) if (len > num*4) len = num * 4; for (i = 0; i < len; i++) { - if ((i % 4) == 0) - val = pad; val = ((int) ucp[i]) + (val << 8); if ((i % 4) == 3) { *buf++ = val;