diff options
author | Horia Geantă <horia.geanta@nxp.com> | 2018-05-23 14:32:42 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-05-31 00:13:47 +0800 |
commit | d9c35771d884c6d8eb57057be4bc9a74161361bc (patch) | |
tree | 678b560f5c842d9b37aa1ade9e0e669034328643 /drivers/crypto/caam | |
parent | b2106476a8cf18318a9677ad669e63502900d907 (diff) | |
download | linux-stable-d9c35771d884c6d8eb57057be4bc9a74161361bc.tar.gz linux-stable-d9c35771d884c6d8eb57057be4bc9a74161361bc.tar.bz2 linux-stable-d9c35771d884c6d8eb57057be4bc9a74161361bc.zip |
crypto: caam/qi - fix warning in init_cgr()
Coverity warns about an
"Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)"
when computing the congestion threshold value.
Even though it is highly unlikely for an overflow to happen,
use this as an opportunity to simplify the code.
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r-- | drivers/crypto/caam/qi.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c index b9480828da38..67f7f8c42c93 100644 --- a/drivers/crypto/caam/qi.c +++ b/drivers/crypto/caam/qi.c @@ -657,9 +657,8 @@ static int init_cgr(struct device *qidev) { int ret; struct qm_mcc_initcgr opts; - const u64 cpus = *(u64 *)qman_affine_cpus(); - const int num_cpus = hweight64(cpus); - const u64 val = num_cpus * MAX_RSP_FQ_BACKLOG_PER_CPU; + const u64 val = (u64)cpumask_weight(qman_affine_cpus()) * + MAX_RSP_FQ_BACKLOG_PER_CPU; ret = qman_alloc_cgrid(&qipriv.cgr.cgrid); if (ret) { |