2021-04-08 10:27:13

by yekai (A)

[permalink] [raw]
Subject: [PATCH 0/2] crypto: correct the use of print format

According to Documentation/core-api/printk-formats.rst,
Use the correct print format. Printing an unsigned int value should use %u
instead of %d. Otherwise printk() might end up displaying negative numbers.

Kai Ye (2):
crypto/atmel - use the correct print format
crypto: hisilicon/sec_drv - use the correct print format

drivers/crypto/atmel-i2c.c | 2 +-
drivers/crypto/atmel-sha.c | 4 ++--
drivers/crypto/hisilicon/sec/sec_drv.c | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)

--
2.8.1


2021-04-08 10:27:13

by yekai (A)

[permalink] [raw]
Subject: [PATCH 2/2] crypto: hisilicon/sec_drv - use the correct print format

According to Documentation/core-api/printk-formats.rst, Use
the correct print format. Printing an unsigned int value should use %u
instead of %d.

Signed-off-by: Kai Ye <[email protected]>
---
drivers/crypto/hisilicon/sec/sec_drv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/hisilicon/sec/sec_drv.c b/drivers/crypto/hisilicon/sec/sec_drv.c
index 91ee2bb..819bbb5 100644
--- a/drivers/crypto/hisilicon/sec/sec_drv.c
+++ b/drivers/crypto/hisilicon/sec/sec_drv.c
@@ -233,7 +233,7 @@ static int sec_queue_map_io(struct sec_queue *queue)
IORESOURCE_MEM,
2 + queue->queue_id);
if (!res) {
- dev_err(dev, "Failed to get queue %d memory resource\n",
+ dev_err(dev, "Failed to get queue %u memory resource\n",
queue->queue_id);
return -ENOMEM;
}
@@ -653,12 +653,12 @@ static int sec_queue_free(struct sec_queue *queue)
struct sec_dev_info *info = queue->dev_info;

if (queue->queue_id >= SEC_Q_NUM) {
- dev_err(info->dev, "No queue %d\n", queue->queue_id);
+ dev_err(info->dev, "No queue %u\n", queue->queue_id);
return -ENODEV;
}

if (!queue->in_use) {
- dev_err(info->dev, "Queue %d is idle\n", queue->queue_id);
+ dev_err(info->dev, "Queue %u is idle\n", queue->queue_id);
return -ENODEV;
}

--
2.8.1

2021-04-16 11:44:20

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 0/2] crypto: correct the use of print format

On Thu, Apr 08, 2021 at 06:23:49PM +0800, Kai Ye wrote:
> According to Documentation/core-api/printk-formats.rst,
> Use the correct print format. Printing an unsigned int value should use %u
> instead of %d. Otherwise printk() might end up displaying negative numbers.
>
> Kai Ye (2):
> crypto/atmel - use the correct print format
> crypto: hisilicon/sec_drv - use the correct print format
>
> drivers/crypto/atmel-i2c.c | 2 +-
> drivers/crypto/atmel-sha.c | 4 ++--
> drivers/crypto/hisilicon/sec/sec_drv.c | 6 +++---
> 3 files changed, 6 insertions(+), 6 deletions(-)

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