Skip to contentSkip to conversation

block: blk-crypto-fallback: remove redundant initialization of variable err

PATCH Applied Colin King 4 participants 4 messages May 26, 2020 – May 27, 2020

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 block: blk-crypto-fallback: remove redundant initialization of variable err

From: Colin Ian King <[email protected]>

The variable err is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 block/blk-crypto-fallback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-crypto-fallback.c +1 -1
index 74ab137ae3ba..6e49688a2d80 100644
@@ -529,7 +529,7 @@ static bool blk_crypto_fallback_inited;
 static int blk_crypto_fallback_init(void)
 {
 	int i;
-	int err = -ENOMEM;
+	int err;
 
 	if (blk_crypto_fallback_inited)
 		return 0;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Colin King

From: Colin Ian King <[email protected]>

The variable err is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 block/blk-crypto-fallback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-crypto-fallback.c +0 -0
index 74ab137ae3ba..6e49688a2d80 100644

block/blk-crypto-fallback.c static bool blk_crypto_fallback_inited; · line 535

Quoted 8 lines
block/blk-crypto-fallback.c +1 -1
@@ -529,7 +529,7 @@ static bool blk_crypto_fallback_inited;
 static int blk_crypto_fallback_init(void)
 {
 	int i;
-	int err = -ENOMEM;
+	int err;
 
 	if (blk_crypto_fallback_inited)
 		return 0;

Looks good, you can add:

- Eric

Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH][next] block: blk-crypto-fallback: remove redundant initialization of variable err'

In reply to Colin King
Quoted 18 lines · Colin King

From: Colin Ian King <[email protected]>

The variable err is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 block/blk-crypto-fallback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-crypto-fallback.c +0 -0
index 74ab137ae3ba..6e49688a2d80 100644

block/blk-crypto-fallback.c static bool blk_crypto_fallback_inited; · line 535

Quoted 8 lines
block/blk-crypto-fallback.c +1 -1
@@ -529,7 +529,7 @@ static bool blk_crypto_fallback_inited;
 static int blk_crypto_fallback_init(void)
 {
 	int i;
-	int err = -ENOMEM;
+	int err;
 
 	if (blk_crypto_fallback_inited)
 		return 0;

Looks good to me - you can add:

Thanks!

Quoted 2 lines

2.25.1

maintainer Applied
#3 lore raw
In reply to Colin King
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The variable err is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Applied, thanks.

Signature · 1 line
Jens Axboe