summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_chardev.c11
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device.c6
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c4
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_events.c14
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c4
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c4
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_priv.h2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_process.c9
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c4
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_queue.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c2
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_svm.c8
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.c10
21 files changed, 49 insertions, 47 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 732ad1224a61..f8c9ccbc4851 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -780,8 +780,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
* nodes, but not more than args->num_of_nodes as that is
* the amount of memory allocated by user
*/
- pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
- GFP_KERNEL);
+ pa = kzalloc_objs(struct kfd_process_device_apertures,
+ args->num_of_nodes, GFP_KERNEL);
if (!pa)
return -ENOMEM;
@@ -2224,7 +2224,8 @@ static int criu_restore_devices(struct kfd_process *p,
if (*priv_offset + (args->num_devices * sizeof(*device_privs)) > max_priv_data_size)
return -EINVAL;
- device_buckets = kmalloc_array(args->num_devices, sizeof(*device_buckets), GFP_KERNEL);
+ device_buckets = kmalloc_objs(*device_buckets, args->num_devices,
+ GFP_KERNEL);
if (!device_buckets)
return -ENOMEM;
@@ -2467,7 +2468,7 @@ static int criu_restore_bos(struct kfd_process *p,
/* Prevent MMU notifications until stage-4 IOCTL (CRIU_RESUME) is received */
amdgpu_amdkfd_block_mmu_notifications(p->kgd_process_info);
- bo_buckets = kvmalloc_array(args->num_bos, sizeof(*bo_buckets), GFP_KERNEL);
+ bo_buckets = kvmalloc_objs(*bo_buckets, args->num_bos, GFP_KERNEL);
if (!bo_buckets)
return -ENOMEM;
@@ -2485,7 +2486,7 @@ static int criu_restore_bos(struct kfd_process *p,
goto exit;
}
- bo_privs = kvmalloc_array(args->num_bos, sizeof(*bo_privs), GFP_KERNEL);
+ bo_privs = kvmalloc_objs(*bo_privs, args->num_bos, GFP_KERNEL);
if (!bo_privs) {
ret = -ENOMEM;
goto exit;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c b/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c
index 9bde2c64540f..46ea876629bc 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c
@@ -146,7 +146,7 @@ void kfd_debugfs_add_process(struct kfd_process *p)
char name[MAX_DEBUGFS_FILENAME_LEN];
struct debugfs_proc_entry *entry;
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry, GFP_KERNEL);
if (!entry)
return;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 9a66ee661e57..d03c3398695b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -478,7 +478,7 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
return NULL;
}
- kfd = kzalloc(sizeof(*kfd), GFP_KERNEL);
+ kfd = kzalloc_obj(*kfd, GFP_KERNEL);
if (!kfd)
return NULL;
@@ -864,7 +864,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
/* Allocate the KFD nodes */
for (i = 0, xcp_idx = 0; i < kfd->num_nodes; i++) {
- node = kzalloc(sizeof(struct kfd_node), GFP_KERNEL);
+ node = kzalloc_obj(struct kfd_node, GFP_KERNEL);
if (!node)
goto node_alloc_error;
@@ -1328,7 +1328,7 @@ int kfd_gtt_sa_allocate(struct kfd_node *node, unsigned int size,
if (size > kfd->gtt_sa_num_of_chunks * kfd->gtt_sa_chunk_size)
return -ENOMEM;
- *mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
+ *mem_obj = kzalloc_obj(struct kfd_mem_obj, GFP_KERNEL);
if (!(*mem_obj))
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 804851632c4c..7707496761ea 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -1401,7 +1401,7 @@ static int register_process(struct device_queue_manager *dqm,
uint64_t pd_base;
int retval;
- n = kzalloc(sizeof(*n), GFP_KERNEL);
+ n = kzalloc_obj(*n, GFP_KERNEL);
if (!n)
return -ENOMEM;
@@ -2921,7 +2921,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_node *dev)
pr_debug("Loading device queue manager\n");
- dqm = kzalloc(sizeof(*dqm), GFP_KERNEL);
+ dqm = kzalloc_obj(*dqm, GFP_KERNEL);
if (!dqm)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 13416bff7763..950717576e20 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -67,7 +67,7 @@ static struct kfd_signal_page *allocate_signal_page(struct kfd_process *p)
void *backing_store;
struct kfd_signal_page *page;
- page = kzalloc(sizeof(*page), GFP_KERNEL);
+ page = kzalloc_obj(*page, GFP_KERNEL);
if (!page)
return NULL;
@@ -337,7 +337,7 @@ static int kfd_event_page_set(struct kfd_process *p, void *kernel_address,
return -EINVAL;
}
- page = kzalloc(sizeof(*page), GFP_KERNEL);
+ page = kzalloc_obj(*page, GFP_KERNEL);
if (!page)
return -ENOMEM;
@@ -405,7 +405,7 @@ int kfd_event_create(struct file *devkfd, struct kfd_process *p,
uint64_t *event_page_offset, uint32_t *event_slot_index)
{
int ret = 0;
- struct kfd_event *ev = kzalloc(sizeof(*ev), GFP_KERNEL);
+ struct kfd_event *ev = kzalloc_obj(*ev, GFP_KERNEL);
if (!ev)
return -ENOMEM;
@@ -458,11 +458,11 @@ int kfd_criu_restore_event(struct file *devkfd,
struct kfd_event *ev = NULL;
int ret = 0;
- ev_priv = kmalloc(sizeof(*ev_priv), GFP_KERNEL);
+ ev_priv = kmalloc_obj(*ev_priv, GFP_KERNEL);
if (!ev_priv)
return -ENOMEM;
- ev = kzalloc(sizeof(*ev), GFP_KERNEL);
+ ev = kzalloc_obj(*ev, GFP_KERNEL);
if (!ev) {
ret = -ENOMEM;
goto exit;
@@ -791,8 +791,8 @@ static struct kfd_event_waiter *alloc_event_waiters(uint32_t num_events)
struct kfd_event_waiter *event_waiters;
uint32_t i;
- event_waiters = kcalloc(num_events, sizeof(struct kfd_event_waiter),
- GFP_KERNEL);
+ event_waiters = kzalloc_objs(struct kfd_event_waiter, num_events,
+ GFP_KERNEL);
if (!event_waiters)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
index d987ff7ccfc9..9e28dda09285 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
@@ -309,7 +309,7 @@ struct kernel_queue *kernel_queue_init(struct kfd_node *dev,
{
struct kernel_queue *kq;
- kq = kzalloc(sizeof(*kq), GFP_KERNEL);
+ kq = kzalloc_obj(*kq, GFP_KERNEL);
if (!kq)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
index d88d0de58edd..93f389ba8cc9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
@@ -51,7 +51,7 @@ struct kfd_mem_obj *allocate_hiq_mqd(struct mqd_manager *mm, struct queue_proper
struct kfd_mem_obj *mqd_mem_obj;
struct kfd_node *dev = mm->dev;
- mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
+ mqd_mem_obj = kzalloc_obj(struct kfd_mem_obj, GFP_KERNEL);
if (!mqd_mem_obj)
return NULL;
@@ -69,7 +69,7 @@ struct kfd_mem_obj *allocate_sdma_mqd(struct mqd_manager *mm,
struct kfd_node *dev = mm->dev;
uint64_t offset;
- mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
+ mqd_mem_obj = kzalloc_obj(struct kfd_mem_obj, GFP_KERNEL);
if (!mqd_mem_obj)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
index 76483d91af98..575aebee8ad1 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
@@ -389,7 +389,7 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
index 0186b3de67c0..daf5e487d87e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
@@ -451,7 +451,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
index c9e397366782..fd258bbc37b4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
@@ -465,7 +465,7 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
index 3bbc2648f51d..e826a4149ff0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
@@ -385,7 +385,7 @@ struct mqd_manager *mqd_manager_init_v12(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
index 0d6b601962eb..6fa17465d3fa 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
@@ -646,7 +646,7 @@ struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
index 3622d8392cb3..5d3b500a4146 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
@@ -147,7 +147,7 @@ static struct kfd_mem_obj *allocate_mqd(struct mqd_manager *mm,
* amdgpu memory functions to do so.
*/
if (node->kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) {
- mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
+ mqd_mem_obj = kzalloc_obj(struct kfd_mem_obj, GFP_KERNEL);
if (!mqd_mem_obj)
return NULL;
retval = amdgpu_amdkfd_alloc_kernel_mem(node->adev,
@@ -960,7 +960,7 @@ struct mqd_manager *mqd_manager_init_v9(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
index e63ef6442b35..27875d88a5ea 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
@@ -446,7 +446,7 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,
if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
return NULL;
- mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+ mqd = kzalloc_obj(*mqd, GFP_KERNEL);
if (!mqd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 9849b54f54ba..a5f479af3607 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -91,7 +91,7 @@
/* Macro for allocating structures */
#define kfd_alloc_struct(ptr_to_struct) \
- ((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL))
+ ((typeof(ptr_to_struct)) kzalloc_obj(*ptr_to_struct, GFP_KERNEL))
#define KFD_MAX_NUM_OF_PROCESSES 512
#define KFD_MAX_NUM_OF_QUEUES_PER_PROCESS 1024
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 8dc6ca8e9062..ff64bde0acd2 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -153,7 +153,7 @@ static void kfd_sdma_activity_worker(struct work_struct *work)
(q->properties.type != KFD_QUEUE_TYPE_SDMA_XGMI))
continue;
- sdma_q = kzalloc(sizeof(struct temp_sdma_queue_list), GFP_KERNEL);
+ sdma_q = kzalloc_obj(struct temp_sdma_queue_list, GFP_KERNEL);
if (!sdma_q) {
dqm_unlock(dqm);
goto cleanup;
@@ -291,7 +291,8 @@ static int kfd_get_cu_occupancy(struct attribute *attr, char *buffer)
wave_cnt = 0;
max_waves_per_cu = 0;
- cu_occupancy = kcalloc(AMDGPU_MAX_QUEUES, sizeof(*cu_occupancy), GFP_KERNEL);
+ cu_occupancy = kzalloc_objs(*cu_occupancy, AMDGPU_MAX_QUEUES,
+ GFP_KERNEL);
if (!cu_occupancy)
return -ENOMEM;
@@ -1592,7 +1593,7 @@ struct kfd_process *create_process(const struct task_struct *thread, bool primar
struct mmu_notifier *mn;
int err = -ENOMEM;
- process = kzalloc(sizeof(*process), GFP_KERNEL);
+ process = kzalloc_obj(*process, GFP_KERNEL);
if (!process)
goto err_alloc_process;
@@ -1708,7 +1709,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_node *dev,
if (WARN_ON_ONCE(p->n_pdds >= MAX_GPU_INSTANCE))
return NULL;
- pdd = kzalloc(sizeof(*pdd), GFP_KERNEL);
+ pdd = kzalloc_obj(*pdd, GFP_KERNEL);
if (!pdd)
return NULL;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 449be58e884c..dac1f9604d8e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -383,7 +383,7 @@ int pqm_create_queue(struct process_queue_manager *pqm,
memset(pdd->proc_ctx_cpu_ptr, 0, AMDGPU_MES_PROC_CTX_SIZE);
}
- pqn = kzalloc(sizeof(*pqn), GFP_KERNEL);
+ pqn = kzalloc_obj(*pqn, GFP_KERNEL);
if (!pqn) {
retval = -ENOMEM;
goto err_allocate_pqn;
@@ -991,7 +991,7 @@ int kfd_criu_restore_queue(struct kfd_process *p,
if (*priv_data_offset + sizeof(*q_data) > max_priv_data_size)
return -EINVAL;
- q_data = kmalloc(sizeof(*q_data), GFP_KERNEL);
+ q_data = kmalloc_obj(*q_data, GFP_KERNEL);
if (!q_data)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
index d1978e3f68be..1285c70a1c3b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
@@ -70,7 +70,7 @@ int init_queue(struct queue **q, const struct queue_properties *properties)
{
struct queue *tmp_q;
- tmp_q = kzalloc(sizeof(*tmp_q), GFP_KERNEL);
+ tmp_q = kzalloc_obj(*tmp_q, GFP_KERNEL);
if (!tmp_q)
return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
index d2bc169e84b0..242e58fea05e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
@@ -370,7 +370,7 @@ int kfd_smi_event_open(struct kfd_node *dev, uint32_t *fd)
struct kfd_smi_client *client;
int ret;
- client = kzalloc(sizeof(struct kfd_smi_client), GFP_KERNEL);
+ client = kzalloc_obj(struct kfd_smi_client, GFP_KERNEL);
if (!client)
return -ENOMEM;
INIT_LIST_HEAD(&client->list);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index fcddb54a439f..e168a74190e3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -168,7 +168,7 @@ svm_range_dma_map_dev(struct amdgpu_device *adev, struct svm_range *prange,
int i, r;
if (!addr) {
- addr = kvcalloc(prange->npages, sizeof(*addr), GFP_KERNEL);
+ addr = kvzalloc_objs(*addr, prange->npages, GFP_KERNEL);
if (!addr)
return -ENOMEM;
prange->dma_addr[gpuidx] = addr;
@@ -329,7 +329,7 @@ svm_range *svm_range_new(struct svm_range_list *svms, uint64_t start,
struct svm_range *prange;
struct kfd_process *p;
- prange = kzalloc(sizeof(*prange), GFP_KERNEL);
+ prange = kzalloc_obj(*prange, GFP_KERNEL);
if (!prange)
return NULL;
@@ -539,7 +539,7 @@ static struct svm_range_bo *svm_range_bo_new(void)
{
struct svm_range_bo *svm_bo;
- svm_bo = kzalloc(sizeof(*svm_bo), GFP_KERNEL);
+ svm_bo = kzalloc_obj(*svm_bo, GFP_KERNEL);
if (!svm_bo)
return NULL;
@@ -1674,7 +1674,7 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
int32_t idx;
int r = 0;
- ctx = kzalloc(sizeof(struct svm_validate_context), GFP_KERNEL);
+ ctx = kzalloc_obj(struct svm_validate_context, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
ctx->process = container_of(prange->svms, struct kfd_process, svms);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 1ccd4514d3ee..8aa86502fceb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -711,7 +711,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
i = 0;
list_for_each_entry(mem, &dev->mem_props, list) {
- mem->kobj = kzalloc(sizeof(struct kobject), GFP_KERNEL);
+ mem->kobj = kzalloc_obj(struct kobject, GFP_KERNEL);
if (!mem->kobj)
return -ENOMEM;
ret = kobject_init_and_add(mem->kobj, &mem_type,
@@ -732,7 +732,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
i = 0;
list_for_each_entry(cache, &dev->cache_props, list) {
- cache->kobj = kzalloc(sizeof(struct kobject), GFP_KERNEL);
+ cache->kobj = kzalloc_obj(struct kobject, GFP_KERNEL);
if (!cache->kobj)
return -ENOMEM;
ret = kobject_init_and_add(cache->kobj, &cache_type,
@@ -753,7 +753,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
i = 0;
list_for_each_entry(iolink, &dev->io_link_props, list) {
- iolink->kobj = kzalloc(sizeof(struct kobject), GFP_KERNEL);
+ iolink->kobj = kzalloc_obj(struct kobject, GFP_KERNEL);
if (!iolink->kobj)
return -ENOMEM;
ret = kobject_init_and_add(iolink->kobj, &iolink_type,
@@ -774,7 +774,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
i = 0;
list_for_each_entry(p2plink, &dev->p2p_link_props, list) {
- p2plink->kobj = kzalloc(sizeof(struct kobject), GFP_KERNEL);
+ p2plink->kobj = kzalloc_obj(struct kobject, GFP_KERNEL);
if (!p2plink->kobj)
return -ENOMEM;
ret = kobject_init_and_add(p2plink->kobj, &iolink_type,
@@ -1381,7 +1381,7 @@ static int kfd_build_p2p_node_entry(struct kfd_topology_device *dev,
{
int ret;
- p2plink->kobj = kzalloc(sizeof(struct kobject), GFP_KERNEL);
+ p2plink->kobj = kzalloc_obj(struct kobject, GFP_KERNEL);
if (!p2plink->kobj)
return -ENOMEM;