summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/intel/speed_select_if
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/platform/x86/intel/speed_select_if
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
downloadlinux-next-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz
linux-next-69050f8d6d075dc01af7a5f2f550a8067510366f.zip
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/platform/x86/intel/speed_select_if')
-rw-r--r--drivers/platform/x86/intel/speed_select_if/isst_if_common.c12
-rw-r--r--drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c7
2 files changed, 8 insertions, 11 deletions
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
index 7449873c3d40..33abff1dbe84 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
@@ -89,7 +89,7 @@ static int isst_store_new_cmd(int cmd, u32 cpu, int mbox_cmd_type, u32 param,
{
struct isst_cmd *sst_cmd;
- sst_cmd = kmalloc(sizeof(*sst_cmd), GFP_KERNEL);
+ sst_cmd = kmalloc_obj(*sst_cmd, GFP_KERNEL);
if (!sst_cmd)
return -ENOMEM;
@@ -425,15 +425,13 @@ static int isst_if_cpu_info_init(void)
{
int ret;
- isst_cpu_info = kcalloc(num_possible_cpus(),
- sizeof(*isst_cpu_info),
- GFP_KERNEL);
+ isst_cpu_info = kzalloc_objs(*isst_cpu_info, num_possible_cpus(),
+ GFP_KERNEL);
if (!isst_cpu_info)
return -ENOMEM;
- isst_pkg_info = kcalloc(topology_max_packages(),
- sizeof(*isst_pkg_info),
- GFP_KERNEL);
+ isst_pkg_info = kzalloc_objs(*isst_pkg_info, topology_max_packages(),
+ GFP_KERNEL);
if (!isst_pkg_info) {
kfree(isst_cpu_info);
return -ENOMEM;
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
index 9c078c8acb50..9242e29aac59 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
@@ -1603,7 +1603,7 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev)
* devm_* allocation here as each partition is a
* different device, which can be unbound.
*/
- tpmi_sst = kzalloc(sizeof(*tpmi_sst), GFP_KERNEL);
+ tpmi_sst = kzalloc_obj(*tpmi_sst, GFP_KERNEL);
if (!tpmi_sst) {
ret = -ENOMEM;
goto unlock_exit;
@@ -1819,9 +1819,8 @@ int tpmi_sst_init(void)
goto init_done;
}
- isst_common.sst_inst = kcalloc(topology_max_packages(),
- sizeof(*isst_common.sst_inst),
- GFP_KERNEL);
+ isst_common.sst_inst = kzalloc_objs(*isst_common.sst_inst,
+ topology_max_packages(), GFP_KERNEL);
if (!isst_common.sst_inst) {
ret = -ENOMEM;
goto init_done;