summaryrefslogtreecommitdiff
path: root/drivers/soc/xilinx
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/soc/xilinx
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
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/soc/xilinx')
-rw-r--r--drivers/soc/xilinx/xlnx_event_manager.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c
index 6fdf4d14b7e7..6a45b1b53caf 100644
--- a/drivers/soc/xilinx/xlnx_event_manager.c
+++ b/drivers/soc/xilinx/xlnx_event_manager.c
@@ -122,7 +122,7 @@ static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, cons
if (!present_in_hash) {
/* Add new entry if not present in HASH table */
- eve_data = kmalloc(sizeof(*eve_data), GFP_KERNEL);
+ eve_data = kmalloc_obj(*eve_data, GFP_KERNEL);
if (!eve_data)
return -ENOMEM;
eve_data->key = key;
@@ -130,7 +130,7 @@ static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, cons
eve_data->wake = wake;
INIT_LIST_HEAD(&eve_data->cb_list_head);
- cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL);
+ cb_data = kmalloc_obj(*cb_data, GFP_KERNEL);
if (!cb_data) {
kfree(eve_data);
return -ENOMEM;
@@ -153,7 +153,7 @@ static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, cons
}
/* Add multiple handler and private data in list */
- cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL);
+ cb_data = kmalloc_obj(*cb_data, GFP_KERNEL);
if (!cb_data)
return -ENOMEM;
cb_data->eve_cb = cb_fun;
@@ -179,7 +179,7 @@ static int xlnx_add_cb_for_suspend(event_cb_func_t cb_fun, void *data)
}
/* Add new entry if not present */
- eve_data = kmalloc(sizeof(*eve_data), GFP_KERNEL);
+ eve_data = kmalloc_obj(*eve_data, GFP_KERNEL);
if (!eve_data)
return -ENOMEM;
@@ -187,7 +187,7 @@ static int xlnx_add_cb_for_suspend(event_cb_func_t cb_fun, void *data)
eve_data->cb_type = PM_INIT_SUSPEND_CB;
INIT_LIST_HEAD(&eve_data->cb_list_head);
- cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL);
+ cb_data = kmalloc_obj(*cb_data, GFP_KERNEL);
if (!cb_data) {
kfree(eve_data);
return -ENOMEM;