aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/omap2/omapfb/dss
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/video/fbdev/omap2/omapfb/dss
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/video/fbdev/omap2/omapfb/dss')
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/dsi.c2
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/manager.c4
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c5
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/overlay.c3
4 files changed, 6 insertions, 8 deletions
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
index 370e8623754e..19498b7ccb14 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c
@@ -1539,7 +1539,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev,
unsigned long flags;
struct dsi_irq_stats *stats;
- stats = kzalloc(sizeof(*stats), GFP_KERNEL);
+ stats = kzalloc_obj(*stats, GFP_KERNEL);
if (!stats) {
seq_printf(s, "out of memory\n");
return;
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/manager.c b/drivers/video/fbdev/omap2/omapfb/dss/manager.c
index c59e5689d6cc..0fc5d43c58ff 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/manager.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/manager.c
@@ -32,8 +32,8 @@ int dss_init_overlay_managers(void)
num_managers = dss_feat_get_num_mgrs();
- managers = kcalloc(num_managers, sizeof(struct omap_overlay_manager),
- GFP_KERNEL);
+ managers = kzalloc_objs(struct omap_overlay_manager, num_managers,
+ GFP_KERNEL);
BUG_ON(managers == NULL);
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
index d80720c84323..098c02164428 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
@@ -46,7 +46,7 @@ static void __init omapdss_update_prop(struct device_node *node, char *compat,
{
struct property *prop;
- prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+ prop = kzalloc_obj(*prop, GFP_KERNEL);
if (!prop)
return;
@@ -110,8 +110,7 @@ static void __init omapdss_omapify_node(struct device_node *node)
static void __init omapdss_add_to_list(struct device_node *node, bool root)
{
- struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
- GFP_KERNEL);
+ struct dss_conv_node *n = kmalloc_obj(struct dss_conv_node, GFP_KERNEL);
if (n) {
n->node = node;
n->root = root;
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/overlay.c b/drivers/video/fbdev/omap2/omapfb/dss/overlay.c
index bbbdc233ee61..cb2a230c57a1 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/overlay.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/overlay.c
@@ -49,8 +49,7 @@ void dss_init_overlays(struct platform_device *pdev)
num_overlays = dss_feat_get_num_ovls();
- overlays = kcalloc(num_overlays, sizeof(struct omap_overlay),
- GFP_KERNEL);
+ overlays = kzalloc_objs(struct omap_overlay, num_overlays, GFP_KERNEL);
BUG_ON(overlays == NULL);