hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/cpufreq/e_powersaver.c
....@@ -1,7 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Based on documentation provided by Dave Jones. Thanks!
3
- *
4
- * Licensed under the terms of the GNU GPL License version 2.
54 *
65 * BIG FAT DISCLAIMER: Work in progress code. Possibly *dangerous*
76 */
....@@ -224,7 +223,6 @@
224223 case EPS_BRAND_C3:
225224 pr_cont("C3\n");
226225 return -ENODEV;
227
- break;
228226 }
229227 /* Enable Enhanced PowerSaver */
230228 rdmsrl(MSR_IA32_MISC_ENABLE, val);
....@@ -323,9 +321,8 @@
323321 states = 2;
324322
325323 /* Allocate private data and frequency table for current cpu */
326
- centaur = kzalloc(sizeof(*centaur)
327
- + (states + 1) * sizeof(struct cpufreq_frequency_table),
328
- GFP_KERNEL);
324
+ centaur = kzalloc(struct_size(centaur, freq_table, states + 1),
325
+ GFP_KERNEL);
329326 if (!centaur)
330327 return -ENOMEM;
331328 eps_cpu[0] = centaur;
....@@ -387,7 +384,7 @@
387384 /* This driver will work only on Centaur C7 processors with
388385 * Enhanced SpeedStep/PowerSaver registers */
389386 static const struct x86_cpu_id eps_cpu_id[] = {
390
- { X86_VENDOR_CENTAUR, 6, X86_MODEL_ANY, X86_FEATURE_EST },
387
+ X86_MATCH_VENDOR_FAM_FEATURE(CENTAUR, 6, X86_FEATURE_EST, NULL),
391388 {}
392389 };
393390 MODULE_DEVICE_TABLE(x86cpu, eps_cpu_id);