diff options
| author | Gustavo A. R. Silva <[email protected]> | 2020-10-08 14:34:50 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2020-10-09 18:44:39 +0000 |
| commit | 201a4eb9dc960b6c081936e0990e289959707996 (patch) | |
| tree | f16b731687fac7a8bbc7bc4b006d5e94e997fe18 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
| parent | drm/amdgpu: Use struct_size() helper in kmalloc() (diff) | |
| download | kernel-201a4eb9dc960b6c081936e0990e289959707996.tar.gz kernel-201a4eb9dc960b6c081936e0990e289959707996.zip | |
amd/amdgpu_ctx: Use struct_size() helper and kmalloc() (v2)
Make use of the new struct_size() helper instead of the offsetof() idiom.
Also, use kmalloc() instead of kcalloc().
v2: squash in kzalloc fix
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index c80d8339f58c..a03398c87344 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -100,7 +100,7 @@ static int amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, u32 hw_ip, enum drm_sched_priority priority; int r; - entity = kcalloc(1, offsetof(typeof(*entity), fences[amdgpu_sched_jobs]), + entity = kzalloc(struct_size(entity, fences, amdgpu_sched_jobs), GFP_KERNEL); if (!entity) return -ENOMEM; |
