diff options
| author | Kees Cook <kees@kernel.org> | 2026-02-20 23:49:23 -0800 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-02-21 01:02:28 -0800 |
| commit | 69050f8d6d075dc01af7a5f2f550a8067510366f (patch) | |
| tree | bb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/gpu/drm/xe/display | |
| parent | d39a1d7486d98668dd34aaa6732aad7977c45f5a (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/gpu/drm/xe/display')
| -rw-r--r-- | drivers/gpu/drm/xe/display/intel_bo.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/xe/display/xe_dsb_buffer.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/xe/display/xe_panic.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/xe/display/xe_stolen.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/xe/display/intel_bo.c b/drivers/gpu/drm/xe/display/intel_bo.c index e8049a255d21..89ee5f3491c6 100644 --- a/drivers/gpu/drm/xe/display/intel_bo.c +++ b/drivers/gpu/drm/xe/display/intel_bo.c @@ -57,7 +57,7 @@ struct intel_frontbuffer *intel_bo_frontbuffer_get(struct drm_gem_object *obj) { struct xe_frontbuffer *front; - front = kmalloc(sizeof(*front), GFP_KERNEL); + front = kmalloc_obj(*front, GFP_KERNEL); if (!front) return NULL; diff --git a/drivers/gpu/drm/xe/display/xe_dsb_buffer.c b/drivers/gpu/drm/xe/display/xe_dsb_buffer.c index fa0acb11eaad..1c35eb2def8c 100644 --- a/drivers/gpu/drm/xe/display/xe_dsb_buffer.c +++ b/drivers/gpu/drm/xe/display/xe_dsb_buffer.c @@ -43,7 +43,7 @@ struct intel_dsb_buffer *intel_dsb_buffer_create(struct drm_device *drm, size_t struct xe_bo *obj; int ret; - dsb_buf = kzalloc(sizeof(*dsb_buf), GFP_KERNEL); + dsb_buf = kzalloc_obj(*dsb_buf, GFP_KERNEL); if (!dsb_buf) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c index ed1f65f5ef4d..0266deccb31a 100644 --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c @@ -95,7 +95,7 @@ static struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct drm_de struct intel_hdcp_gsc_context *gsc_context; int ret; - gsc_context = kzalloc(sizeof(*gsc_context), GFP_KERNEL); + gsc_context = kzalloc_obj(*gsc_context, GFP_KERNEL); if (!gsc_context) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/xe/display/xe_panic.c b/drivers/gpu/drm/xe/display/xe_panic.c index e078494dc8ba..e68abd9268f2 100644 --- a/drivers/gpu/drm/xe/display/xe_panic.c +++ b/drivers/gpu/drm/xe/display/xe_panic.c @@ -79,7 +79,7 @@ static struct intel_panic *xe_panic_alloc(void) { struct intel_panic *panic; - panic = kzalloc(sizeof(*panic), GFP_KERNEL); + panic = kzalloc_obj(*panic, GFP_KERNEL); return panic; } diff --git a/drivers/gpu/drm/xe/display/xe_stolen.c b/drivers/gpu/drm/xe/display/xe_stolen.c index 8dc2f86ec602..fac3d60e8a31 100644 --- a/drivers/gpu/drm/xe/display/xe_stolen.c +++ b/drivers/gpu/drm/xe/display/xe_stolen.c @@ -86,7 +86,7 @@ static struct intel_stolen_node *xe_stolen_node_alloc(struct drm_device *drm) struct xe_device *xe = to_xe_device(drm); struct intel_stolen_node *node; - node = kzalloc(sizeof(*node), GFP_KERNEL); + node = kzalloc_obj(*node, GFP_KERNEL); if (!node) return NULL; |
