[PATCH] x86/mce: Remove redundant check from mce_device_create()

Nikolay Borisov posted 1 patch 2 years, 1 month ago
arch/x86/kernel/cpu/mce/core.c | 3 ---
1 file changed, 3 deletions(-)
[PATCH] x86/mce: Remove redundant check from mce_device_create()
Posted by Nikolay Borisov 2 years, 1 month ago
mce_device_create() is called only from mce_cpu_online() which in turn
will be called iff mce is available. That is, at the time of
mce_device_create() call it's guaranteed that mce is available. No need
to duplicate this check so let's remove it.

Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
---
 arch/x86/kernel/cpu/mce/core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 7b397370b4d6..71999f97a3c8 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -2568,9 +2568,6 @@ static int mce_device_create(unsigned int cpu)
 	int err;
 	int i, j;
 
-	if (!mce_available(&boot_cpu_data))
-		return -EIO;
-
 	dev = per_cpu(mce_device, cpu);
 	if (dev)
 		return 0;
-- 
2.34.1
[tip: ras/core] x86/mce: Remove redundant check from mce_device_create()
Posted by tip-bot2 for Nikolay Borisov 2 years, 1 month ago
The following commit has been merged into the ras/core branch of tip:

Commit-ID:     612905e13b8769caca7ec4194a8aceb24efa4d5c
Gitweb:        https://git.kernel.org/tip/612905e13b8769caca7ec4194a8aceb24efa4d5c
Author:        Nikolay Borisov <nik.borisov@suse.com>
AuthorDate:    Tue, 07 Nov 2023 18:55:29 +02:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Wed, 15 Nov 2023 17:19:14 +01:00

x86/mce: Remove redundant check from mce_device_create()

mce_device_create() is called only from mce_cpu_online() which in turn
will be called iff MCA support is available. That is, at the time of
mce_device_create() call it's guaranteed that MCA support is available.
No need to duplicate this check so remove it.

  [ bp: Massage commit message. ]

Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231107165529.407349-1-nik.borisov@suse.com
---
 arch/x86/kernel/cpu/mce/core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index df8d25e..1642018 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -2584,9 +2584,6 @@ static int mce_device_create(unsigned int cpu)
 	int err;
 	int i, j;
 
-	if (!mce_available(&boot_cpu_data))
-		return -EIO;
-
 	dev = per_cpu(mce_device, cpu);
 	if (dev)
 		return 0;