Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB0DCC433F5 for ; Thu, 4 Nov 2021 09:34:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C81360E9B for ; Thu, 4 Nov 2021 09:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231152AbhKDJgu (ORCPT ); Thu, 4 Nov 2021 05:36:50 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:30920 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbhKDJgs (ORCPT ); Thu, 4 Nov 2021 05:36:48 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HlJHk3Fhzzcb1M; Thu, 4 Nov 2021 17:29:22 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 4 Nov 2021 17:34:07 +0800 Received: from [10.67.102.118] (10.67.102.118) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 4 Nov 2021 17:34:06 +0800 Subject: Re: [PATCH] crypto: hisilicon/hpre - use swap() to make code cleaner To: , CC: , , , , Yang Guang , Zeal Robot References: <20211104061910.1505738-1-yang.guang5@zte.com.cn> From: liulongfang Message-ID: <5913a9db-6cb7-6752-51ec-f6d09aa612ff@huawei.com> Date: Thu, 4 Nov 2021 17:34:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20211104061910.1505738-1-yang.guang5@zte.com.cn> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.118] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/11/4 14:19, davidcomponentone@gmail.com wrote: > From: Yang Guang > > Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid > opencoding it. > > Reported-by: Zeal Robot > Signed-off-by: Yang Guang > --- > drivers/crypto/hisilicon/hpre/hpre_crypto.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c > index a032c192ef1d..0f1724d355b8 100644 > --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c > +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c > @@ -1177,13 +1177,10 @@ static void hpre_rsa_exit_tfm(struct crypto_akcipher *tfm) > static void hpre_key_to_big_end(u8 *data, int len) > { > int i, j; > - u8 tmp; > > for (i = 0; i < len / 2; i++) { > j = len - i - 1; > - tmp = data[j]; > - data[j] = data[i]; > - data[i] = tmp; > + swap(data[j], data[i]); > } > } > > OK! Thanks. Longfang.