Skip to contentSkip to conversation

x86/microcode/AMD: remove redundant null check on mc

PATCH Applied Colin King 3 participants 3 messages Mar 15, 2017 – Mar 18, 2017

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 x86/microcode/AMD: remove redundant null check on mc

From: Colin Ian King <[email protected]>

mc is a pointer to the static u8 array amd_ucode_patch and therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1372871 ("Logically Dead Code")

---
 arch/x86/kernel/cpu/microcode/amd.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +0 -3
index 7889ae4..f2afe99 100644
@@ -352,9 +352,6 @@ void reload_ucode_amd(void)
 	u32 rev, dummy;
 
 	mc = (struct microcode_amd *)amd_ucode_patch;
-	if (!mc)
-		return;
-
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 
 	if (rev < mc->hdr.patch_id) {
Signature · 1 line
2.10.2
maintainer Applied
#1 lore raw
Quoted 11 lines · Colin King

From: Colin Ian King <[email protected]>

mc is a pointer to the static u8 array amd_ucode_patch and therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1372871 ("Logically Dead Code")

---
 arch/x86/kernel/cpu/microcode/amd.c | 3 ---
 1 file changed, 3 deletions(-)

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#2 lore raw

[tip:x86/microcode] x86/microcode/AMD: Remove redundant NULL check on mc

In reply to Colin King
x86/microcode/AMD: Remove redundant NULL check on mc
Commit-ID:  cf8178f78645148dc38b28263b9d3f604148e3a8
Gitweb:     http://git.kernel.org/tip/cf8178f78645148dc38b28263b9d3f604148e3a8
Author:     Colin Ian King <[email protected]>
AuthorDate: Wed, 15 Mar 2017 17:10:10 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 18 Mar 2017 12:31:58 +0100

x86/microcode/AMD: Remove redundant NULL check on mc

mc is a pointer to the static u8 array amd_ucode_patch and therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1372871 ("Logically Dead Code")

---
 arch/x86/kernel/cpu/microcode/amd.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +0 -2
index 7889ae4..1d38e53 100644
@@ -352,8 +352,6 @@ void reload_ucode_amd(void)
 	u32 rev, dummy;
 
 	mc = (struct microcode_amd *)amd_ucode_patch;
-	if (!mc)
-		return;
 
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);