Skip to contentSkip to conversation

crypto: octeontx2 - uninitialized variable in kvf_limits_store()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 27, 2021 – Dec 3, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: octeontx2 - uninitialized variable in kvf_limits_store()

If kstrtoint() fails then "lfs_num" is uninitialized and the warning doesn't make any sense. Just delete it.

Fixes 8ec8015a3168 ("crypto: octeontx2 - add support to process the crypto request")
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +4 -5
index 146a55ac4b9b..be1ad55a208f 100644
@@ -494,12 +494,11 @@ static ssize_t kvf_limits_store(struct device *dev,
 {
 	struct otx2_cptpf_dev *cptpf = dev_get_drvdata(dev);
 	int lfs_num;
+	int ret;
 
-	if (kstrtoint(buf, 0, &lfs_num)) {
-		dev_err(dev, "lfs count %d must be in range [1 - %d]\n",
-			lfs_num, num_online_cpus());
-		return -EINVAL;
-	}
+	ret = kstrtoint(buf, 0, &lfs_num);
+	if (ret)
+		return ret;
 	if (lfs_num < 1 || lfs_num > num_online_cpus()) {
 		dev_err(dev, "lfs count %d must be in range [1 - %d]\n",
 			lfs_num, num_online_cpus());
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 8 lines · Dan Carpenter

If kstrtoint() fails then "lfs_num" is uninitialized and the warning doesn't make any sense. Just delete it.

Fixes 8ec8015a3168 ("crypto: octeontx2 - add support to process the crypto request")
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt