Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3807977pxv; Mon, 19 Jul 2021 09:11:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAnNDg2fWAZN7ICr8oPH5e8seqsGASOdYlZU/54eT4HqnsHsUdIkIuUvAArUg72PCG+Y0W X-Received: by 2002:a17:906:7302:: with SMTP id di2mr27739865ejc.409.1626711115390; Mon, 19 Jul 2021 09:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626711115; cv=none; d=google.com; s=arc-20160816; b=H9HJdmtAu2hTr9/V7dPWhnAl76Xa8qZ2F/CML1hWwoPZBtl/uCUHJJYwvMbGTglitu IvQpnDYbPxRZWKjDE0SH/KLck79Bf3ipIjyLrz+kOyjQjnrfyF90HvGhafDiFJNTASIu aFcEoZsx6nRD4ZySvUgr+LBilJOUBsHVJofWHVgskTXe5qDKBVdBQbZK2nSp9YHJouDn fE4cnxUM5vrduAhPzOGwfKgrkPvYRjQepvhxR2LBzPLn5JqUgHhyyBS1yUIFJ3/DnWAf MtNfsGJ2IEOYuBZaCfPafmBEsLo9jFcejcGwrHIGPLlFTMfyH+rKqRig0y7fwO/nypYt qaxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:user-agent:in-reply-to:subject:cc:to:from:message-id :date; bh=lXG8Bt9TwGkb6o7fRTJxDwLflkfpYl2xA2LDYz6Lwd8=; b=FrckCrqSAw3OEHqTqrQ0f8pYKN61JMEqxP0HReeNrm4epEzAvl5bSYhyq+HDO0bn4t susu7Tm2SYUsNJwiHwIAjqdl+vZYMiAohpIqrEPa11GkMFxAl9K8AXPWmvfHvmWTOiFi o7t5TGN+kFpKxj31tI9B2D2wJA7hBUIr2+Y2yfNO3VInyhEsuhqlKhV4LNmWTV7FWICD lJrHuxqkruQBoG7XjH0dk3+m9bQjLJkpqp6Y0KvchnGADTyMQlL7TU83hzK0/ji9Jcch 505dgdmOjEP9uWTQOfWwCnR1YC16tHtucpUMR3CcFDzq+KBtqqG/ZeyeiaQEq/p0VIJz iA1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si14072788edx.205.2021.07.19.09.11.31; Mon, 19 Jul 2021 09:11:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346635AbhGSP3i convert rfc822-to-8bit (ORCPT + 99 others); Mon, 19 Jul 2021 11:29:38 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:9273 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349217AbhGSP0Q (ORCPT ); Mon, 19 Jul 2021 11:26:16 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4GT6DF4xN0zB58n; Mon, 19 Jul 2021 18:06:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id COi69W5SXrwD; Mon, 19 Jul 2021 18:06:53 +0200 (CEST) Received: from vm-hermes.si.c-s.fr (vm-hermes.si.c-s.fr [192.168.25.253]) by pegase1.c-s.fr (Postfix) with ESMTP id 4GT6DF3zhRzB58l; Mon, 19 Jul 2021 18:06:53 +0200 (CEST) Received: by vm-hermes.si.c-s.fr (Postfix, from userid 33) id BD3BA37C; Mon, 19 Jul 2021 18:12:05 +0200 (CEST) Received: from 37.172.104.68 ([37.172.104.68]) by messagerie.c-s.fr (Horde Framework) with HTTP; Mon, 19 Jul 2021 18:12:05 +0200 Date: Mon, 19 Jul 2021 18:12:05 +0200 Message-ID: <20210719181205.Horde.xU8C00MIRgjqhZQ3-RrANw8@messagerie.c-s.fr> From: Christophe Leroy To: Salah Triki Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, davem@davemloft.net, herbert@gondor.apana.org.au, paulus@samba.org, benh@kernel.crashing.org, mpe@ellerman.id.au, haren@us.ibm.com Subject: Re: [PATCH] replace if with min In-Reply-To: <20210712204546.GA1492390@pc> User-Agent: Internet Messaging Program (IMP) H5 (6.2.3) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Salah Triki a écrit : > Replace if with min in order to make code more clean. > > Signed-off-by: Salah Triki > --- > drivers/crypto/nx/nx-842.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c > index 2ab90ec10e61..0d1d5a463899 100644 > --- a/drivers/crypto/nx/nx-842.c > +++ b/drivers/crypto/nx/nx-842.c > @@ -134,8 +134,7 @@ EXPORT_SYMBOL_GPL(nx842_crypto_exit); > static void check_constraints(struct nx842_constraints *c) > { > /* limit maximum, to always have enough bounce buffer to decompress */ > - if (c->maximum > BOUNCE_BUFFER_SIZE) > - c->maximum = BOUNCE_BUFFER_SIZE; > + c->maximum = min(c->maximum, BOUNCE_BUFFER_SIZE); For me the code is less clear with this change, and in addition it slightly changes the behaviour. Before, the write was done only when the value was changing. Now you rewrite the value always, even when it doesn't change. > } > > static int nx842_crypto_add_header(struct nx842_crypto_header *hdr, u8 *buf) > -- > 2.25.1