Skip to contentSkip to conversation

ssb: Remove redundant assignment to err

PATCH In review Yang Li 3 participants 3 messages Apr 29, 2021 – Jun 15, 2021 Sonics silicon backplane driver (ssb)

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 ssb: Remove redundant assignment to err

Variable 'err' is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

drivers/ssb/main.c:1306:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] drivers/ssb/main.c:1312:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]

---
 drivers/ssb/main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/ssb/main.c +0 -2
index 0a26984..ab23554 100644
@@ -1303,13 +1303,11 @@ static int __init ssb_modinit(void)
 	if (err) {
 		pr_err("Broadcom 43xx PCI-SSB-bridge initialization failed\n");
 		/* don't fail SSB init because of this */
-		err = 0;
 	}
 	err = ssb_host_pcmcia_init();
 	if (err) {
 		pr_err("PCMCIA host initialization failed\n");
 		/* don't fail SSB init because of this */
-		err = 0;
 	}
 	err = ssb_gige_init();
 	if (err) {
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · On Thu, 29 Apr 2021 18:47:10 +0800 Yang Li <[email protected]> wrote:

Variable 'err' is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

drivers/ssb/main.c:1306:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] drivers/ssb/main.c:1312:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]

---
 drivers/ssb/main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/ssb/main.c +0 -0
index 0a26984..ab23554 100644
@@ -1303,13 +1303,11 @@ static int __init ssb_modinit(void)
 	if (err) {
 		pr_err("Broadcom 43xx PCI-SSB-bridge initialization failed\n");
 		/* don't fail SSB init because of this */

drivers/ssb/main.c static int __init ssb_modinit(void) · line 1313

Quoted 10 lines
drivers/ssb/main.c +0 -2
-		err = 0;
 	}
 	err = ssb_host_pcmcia_init();
 	if (err) {
 		pr_err("PCMCIA host initialization failed\n");
 		/* don't fail SSB init because of this */
-		err = 0;
 	}
 	err = ssb_gige_init();
 	if (err) {

The assignment is there just as a visual guide to tell the reader that we ignore the error.
However, there's also a comment that says the same thing. Therefore:

Signature · 1 line
Michael
#2 lore raw
In reply to Yang Li
Quoted 6 lines · Yang Li

Variable 'err' is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

Quoted 8 lines

drivers/ssb/main.c:1306:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] drivers/ssb/main.c:1312:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]

Patch applied to wireless-drivers-next.git, thanks.

7557dfde1bd1 ssb: Remove redundant assignment to err

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches