Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH 0/3] crypto: Use int type to store negative error codes
@ 2025-09-03 13:25 Qianfeng Rong
  2025-09-03 13:25 ` [PATCH 3/3] crypto: tegra - " Qianfeng Rong
  2025-09-13  4:27 ` [PATCH 0/3] crypto: " Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Qianfeng Rong @ 2025-09-03 13:25 UTC (permalink / raw)
  To: Ashish Kalra, Tom Lendacky, John Allen, Herbert Xu,
	David S. Miller, Akhil R, Thierry Reding, Jonathan Hunter,
	Uwe Kleine-König, Colin Ian King, Qianfeng Rong,
	open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - SE...,
	open list, open list:TEGRA ARCHITECTURE SUPPORT

The 'ret' variable usually is used to store returns from some functions,
which return either zero on success or negative error codes on failure.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing.  Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

Change 'ret' from u32/unsigned int to int type.  No effect on runtime.

Qianfeng Rong (3):
  crypto: ccp - Use int type to store negative error codes
  crypto: hisilicon/sec - Use int type to store negative error codes
  crypto: tegra - Use int type to store negative error codes

 drivers/crypto/ccp/sev-dev.c           | 3 ++-
 drivers/crypto/hisilicon/sec/sec_drv.c | 3 ++-
 drivers/crypto/tegra/tegra-se-hash.c   | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] crypto: tegra - Use int type to store negative error codes
  2025-09-03 13:25 [PATCH 0/3] crypto: Use int type to store negative error codes Qianfeng Rong
@ 2025-09-03 13:25 ` Qianfeng Rong
  2025-09-13  4:27 ` [PATCH 0/3] crypto: " Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Qianfeng Rong @ 2025-09-03 13:25 UTC (permalink / raw)
  To: Akhil R, Herbert Xu, David S. Miller, Thierry Reding,
	Jonathan Hunter, open list:CRYPTO API,
	open list:TEGRA ARCHITECTURE SUPPORT, open list
  Cc: Qianfeng Rong

Change the 'ret' variable in tegra_sha_do_update() from unsigned int to
int, as it needs to store either negative error codes or zero returned
by tegra_se_host1x_submit().

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/crypto/tegra/tegra-se-hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/tegra/tegra-se-hash.c b/drivers/crypto/tegra/tegra-se-hash.c
index d09b4aaeecef..4a298ace6e9f 100644
--- a/drivers/crypto/tegra/tegra-se-hash.c
+++ b/drivers/crypto/tegra/tegra-se-hash.c
@@ -400,8 +400,9 @@ static int tegra_sha_do_update(struct ahash_request *req)
 	struct tegra_sha_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req));
 	struct tegra_sha_reqctx *rctx = ahash_request_ctx(req);
 	struct tegra_se *se = ctx->se;
-	unsigned int nblks, nresidue, size, ret;
+	unsigned int nblks, nresidue, size;
 	u32 *cpuvaddr = se->cmdbuf->addr;
+	int ret;
 
 	nresidue = (req->nbytes + rctx->residue.size) % rctx->blk_size;
 	nblks = (req->nbytes + rctx->residue.size) / rctx->blk_size;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/3] crypto: Use int type to store negative error codes
  2025-09-03 13:25 [PATCH 0/3] crypto: Use int type to store negative error codes Qianfeng Rong
  2025-09-03 13:25 ` [PATCH 3/3] crypto: tegra - " Qianfeng Rong
@ 2025-09-13  4:27 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2025-09-13  4:27 UTC (permalink / raw)
  To: Qianfeng Rong
  Cc: Ashish Kalra, Tom Lendacky, John Allen, David S. Miller, Akhil R,
	Thierry Reding, Jonathan Hunter, Uwe Kleine-König,
	Colin Ian King,
	open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - SE...,
	open list, open list:TEGRA ARCHITECTURE SUPPORT

On Wed, Sep 03, 2025 at 09:25:34PM +0800, Qianfeng Rong wrote:
> The 'ret' variable usually is used to store returns from some functions,
> which return either zero on success or negative error codes on failure.
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but can be confusing.  Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> Change 'ret' from u32/unsigned int to int type.  No effect on runtime.
> 
> Qianfeng Rong (3):
>   crypto: ccp - Use int type to store negative error codes
>   crypto: hisilicon/sec - Use int type to store negative error codes
>   crypto: tegra - Use int type to store negative error codes
> 
>  drivers/crypto/ccp/sev-dev.c           | 3 ++-
>  drivers/crypto/hisilicon/sec/sec_drv.c | 3 ++-
>  drivers/crypto/tegra/tegra-se-hash.c   | 3 ++-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> -- 
> 2.34.1

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-13  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03 13:25 [PATCH 0/3] crypto: Use int type to store negative error codes Qianfeng Rong
2025-09-03 13:25 ` [PATCH 3/3] crypto: tegra - " Qianfeng Rong
2025-09-13  4:27 ` [PATCH 0/3] crypto: " Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox