[PATCH 2/5] crypto: hisilicon/qm - change data type in min_t

Weili Qian posted 5 patches 2 years, 7 months ago
There is a newer version of this series
[PATCH 2/5] crypto: hisilicon/qm - change data type in min_t
Posted by Weili Qian 2 years, 7 months ago
'act_q_num = min_t(int, act_q_num, max_qp_num)', 'act_q_num'
and 'max_qp_num' are 'u32' type, change min_t() to use 'u32'
type instead of 'int'.

Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 drivers/crypto/hisilicon/qm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 4e277168b48d..c440d79f2e84 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -3493,7 +3493,7 @@ static int qm_vf_q_assign(struct hisi_qm *qm, u32 num_vfs)
 			act_q_num = q_num;
 		}
 
-		act_q_num = min_t(int, act_q_num, max_qp_num);
+		act_q_num = min_t(u32, act_q_num, max_qp_num);
 		ret = hisi_qm_set_vft(qm, i, q_base, act_q_num);
 		if (ret) {
 			for (j = num_vfs; j > i; j--)
-- 
2.33.0
Re: [PATCH 2/5] crypto: hisilicon/qm - change data type in min_t
Posted by Herbert Xu 2 years, 7 months ago
On Fri, Feb 03, 2023 at 05:37:27PM +0800, Weili Qian wrote:
> 'act_q_num = min_t(int, act_q_num, max_qp_num)', 'act_q_num'
> and 'max_qp_num' are 'u32' type, change min_t() to use 'u32'
> type instead of 'int'.

If they are of the same type, why not just do min?

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
Re: [PATCH 2/5] crypto: hisilicon/qm - change data type in min_t
Posted by Weili Qian 2 years, 7 months ago

On 2023/2/9 17:32, Herbert Xu wrote:
> On Fri, Feb 03, 2023 at 05:37:27PM +0800, Weili Qian wrote:
>> 'act_q_num = min_t(int, act_q_num, max_qp_num)', 'act_q_num'
>> and 'max_qp_num' are 'u32' type, change min_t() to use 'u32'
>> type instead of 'int'.
> 
> If they are of the same type, why not just do min?
> 
> Thanks,
> 

Thanks for your reminder. I will fix it in next version.

Best regards,
Weili