RE: [PATCH 2/7] crypto: stm32/hash: Simplify code

From: lionel.debieve
Date: Tue Jan 03 2023 - 03:13:07 EST


Hi Linus

Acked-by: Lionel Debieve <lionel.debieve@xxxxxxxxxxx>


ST Restricted

-----Original Message-----
From: Linus Walleij <linus.walleij@xxxxxxxxxx>
Sent: Wednesday, December 28, 2022 12:04 AM
To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>; Rob Herring <robh+dt@xxxxxxxxxx>; Krzysztof Kozlowski <krzysztof.kozlowski+dt@xxxxxxxxxx>; Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>; Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>; Lionel Debieve <lionel.debieve@xxxxxxxxxxx>
Cc: linux-crypto@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Linus Walleij <linus.walleij@xxxxxxxxxx>
Subject: [PATCH 2/7] crypto: stm32/hash: Simplify code

We are passing (rctx->flags & HASH_FLAGS_FINUP) as indicator for the final request but we already know this to be true since we are in the (final) arm of an if-statement set from the same flag. Just open-code it as true.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
drivers/crypto/stm32/stm32-hash.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index d33006d43f76..0473ced7b4ea 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -399,8 +399,7 @@ static int stm32_hash_update_cpu(struct stm32_hash_dev *hdev)
if (final) {
bufcnt = rctx->bufcnt;
rctx->bufcnt = 0;
- err = stm32_hash_xmit_cpu(hdev, rctx->buffer, bufcnt,
- (rctx->flags & HASH_FLAGS_FINUP));
+ err = stm32_hash_xmit_cpu(hdev, rctx->buffer, bufcnt, 1);
}

return err;
--
2.38.1