summaryrefslogtreecommitdiff
path: root/arch/mips
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-21 10:49:23 +0300
committerKees Cook <kees@kernel.org>2026-02-21 12:02:28 +0300
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /arch/mips
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
downloadlinux-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.xz
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 'arch/mips')
-rw-r--r--arch/mips/alchemy/common/clock.c8
-rw-r--r--arch/mips/alchemy/common/dbdma.c8
-rw-r--r--arch/mips/alchemy/common/platform.c4
-rw-r--r--arch/mips/alchemy/devboards/platform.c8
-rw-r--r--arch/mips/bcm47xx/setup.c2
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c10
-rw-r--r--arch/mips/kernel/module.c2
-rw-r--r--arch/mips/kernel/smp-cps.c14
-rw-r--r--arch/mips/kernel/vpe.c6
-rw-r--r--arch/mips/lantiq/falcon/sysctrl.c2
-rw-r--r--arch/mips/lantiq/xway/gptu.c2
-rw-r--r--arch/mips/lantiq/xway/sysctrl.c10
-rw-r--r--arch/mips/loongson64/init.c2
-rw-r--r--arch/mips/pci/pci-alchemy.c2
-rw-r--r--arch/mips/pci/pci-xtalk-bridge.c2
-rw-r--r--arch/mips/ralink/mt7620.c2
-rw-r--r--arch/mips/ralink/mt7621.c2
-rw-r--r--arch/mips/ralink/rt288x.c2
-rw-r--r--arch/mips/ralink/rt305x.c2
-rw-r--r--arch/mips/ralink/rt3883.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-gio.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-xtalk.c4
-rw-r--r--arch/mips/sgi-ip30/ip30-irq.c2
-rw-r--r--arch/mips/sgi-ip30/ip30-xtalk.c4
-rw-r--r--arch/mips/txx9/generic/pci.c2
-rw-r--r--arch/mips/txx9/generic/setup.c4
27 files changed, 55 insertions, 57 deletions
diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
index 551b0d21d9dc..7ed84f26ac40 100644
--- a/arch/mips/alchemy/common/clock.c
+++ b/arch/mips/alchemy/common/clock.c
@@ -154,7 +154,7 @@ static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name,
struct clk_hw *h;
struct clk *clk;
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h, GFP_KERNEL);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -249,7 +249,7 @@ static struct clk __init *alchemy_clk_setup_aux(const char *parent_name,
struct clk *c;
struct alchemy_auxpll_clk *a;
- a = kzalloc(sizeof(*a), GFP_KERNEL);
+ a = kzalloc_obj(*a, GFP_KERNEL);
if (!a)
return ERR_PTR(-ENOMEM);
@@ -775,7 +775,7 @@ static int __init alchemy_clk_init_fgens(int ctype)
}
id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE;
- a = kcalloc(6, sizeof(*a), GFP_KERNEL);
+ a = kzalloc_objs(*a, 6, GFP_KERNEL);
if (!a)
return -ENOMEM;
@@ -996,7 +996,7 @@ static int __init alchemy_clk_setup_imux(int ctype)
return -ENODEV;
}
- a = kcalloc(6, sizeof(*a), GFP_KERNEL);
+ a = kzalloc_objs(*a, 6, GFP_KERNEL);
if (!a)
return -ENOMEM;
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 6c2c2010bbae..eb420a6f2f9f 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -310,7 +310,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
* If kmalloc fails, it is caught below same
* as a channel not available.
*/
- ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
+ ctp = kmalloc_obj(chan_tab_t, GFP_ATOMIC);
chan_tab_ptr[i] = ctp;
break;
}
@@ -412,8 +412,8 @@ u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
* and if we try that first we are likely to not waste larger
* slabs of memory.
*/
- desc_base = (u32)kmalloc_array(entries, sizeof(au1x_ddma_desc_t),
- GFP_KERNEL|GFP_DMA);
+ desc_base = (u32) kmalloc_objs(au1x_ddma_desc_t, entries,
+ GFP_KERNEL | GFP_DMA);
if (desc_base == 0)
return 0;
@@ -1057,7 +1057,7 @@ static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable)
{
int ret;
- dbdev_tab = kcalloc(DBDEV_TAB_SIZE, sizeof(dbdev_tab_t), GFP_KERNEL);
+ dbdev_tab = kzalloc_objs(dbdev_tab_t, DBDEV_TAB_SIZE, GFP_KERNEL);
if (!dbdev_tab)
return -ENOMEM;
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index da74cae6b43a..931cf459facb 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -202,10 +202,10 @@ static unsigned long alchemy_ehci_data[][2] __initdata = {
static int __init _new_usbres(struct resource **r, struct platform_device **d)
{
- *r = kcalloc(2, sizeof(struct resource), GFP_KERNEL);
+ *r = kzalloc_objs(struct resource, 2, GFP_KERNEL);
if (!*r)
return -ENOMEM;
- *d = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
+ *d = kzalloc_obj(struct platform_device, GFP_KERNEL);
if (!*d) {
kfree(*r);
return -ENOMEM;
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c
index 754bdd2ca630..40e804a898ec 100644
--- a/arch/mips/alchemy/devboards/platform.c
+++ b/arch/mips/alchemy/devboards/platform.c
@@ -87,7 +87,7 @@ int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start,
if (stschg_irq)
cnt++;
- sr = kcalloc(cnt, sizeof(struct resource), GFP_KERNEL);
+ sr = kzalloc_objs(struct resource, cnt, GFP_KERNEL);
if (!sr)
return -ENOMEM;
@@ -162,15 +162,15 @@ int __init db1x_register_norflash(unsigned long size, int width,
return -EINVAL;
ret = -ENOMEM;
- parts = kcalloc(5, sizeof(struct mtd_partition), GFP_KERNEL);
+ parts = kzalloc_objs(struct mtd_partition, 5, GFP_KERNEL);
if (!parts)
goto out;
- res = kzalloc(sizeof(struct resource), GFP_KERNEL);
+ res = kzalloc_obj(struct resource, GFP_KERNEL);
if (!res)
goto out1;
- pfd = kzalloc(sizeof(struct physmap_flash_data), GFP_KERNEL);
+ pfd = kzalloc_obj(struct physmap_flash_data, GFP_KERNEL);
if (!pfd)
goto out2;
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 38ed61b4bd96..d9e569af0d86 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -187,7 +187,7 @@ static struct device * __init bcm47xx_setup_device(void)
struct device *dev;
int err;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return NULL;
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 5c3de175ef5b..2a91e678fc1a 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -100,7 +100,7 @@ static int octeon_irq_set_ciu_mapping(int irq, int line, int bit, int gpio_line,
{
struct octeon_ciu_chip_data *cd;
- cd = kzalloc(sizeof(*cd), GFP_KERNEL);
+ cd = kzalloc_obj(*cd, GFP_KERNEL);
if (!cd)
return -ENOMEM;
@@ -1462,7 +1462,7 @@ static int __init octeon_irq_init_ciu(
struct irq_domain *ciu_domain = NULL;
struct octeon_irq_ciu_domain_data *dd;
- dd = kzalloc(sizeof(*dd), GFP_KERNEL);
+ dd = kzalloc_obj(*dd, GFP_KERNEL);
if (!dd)
return -ENOMEM;
@@ -1633,7 +1633,7 @@ static int __init octeon_irq_init_gpio(
return -EINVAL;
}
- gpiod = kzalloc(sizeof(*gpiod), GFP_KERNEL);
+ gpiod = kzalloc_obj(*gpiod, GFP_KERNEL);
if (gpiod) {
/* gpio domain host_data is the base hwirq number. */
gpiod->base_hwirq = base_hwirq;
@@ -2223,7 +2223,7 @@ static int octeon_irq_cib_map(struct irq_domain *d,
return -EINVAL;
}
- cd = kzalloc(sizeof(*cd), GFP_KERNEL);
+ cd = kzalloc_obj(*cd, GFP_KERNEL);
if (!cd)
return -ENOMEM;
@@ -2304,7 +2304,7 @@ static int __init octeon_irq_init_cib(struct device_node *ciu_node,
return -EINVAL;
}
- host_data = kzalloc(sizeof(*host_data), GFP_KERNEL);
+ host_data = kzalloc_obj(*host_data, GFP_KERNEL);
if (!host_data)
return -ENOMEM;
raw_spin_lock_init(&host_data->lock);
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index ba0f62d8eff5..9ef50013c818 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -72,7 +72,7 @@ static int apply_r_mips_hi16(struct module *me, u32 *location, Elf_Addr v,
* the carry we need to add. Save the information, and let LO16 do the
* actual relocation.
*/
- n = kmalloc(sizeof *n, GFP_KERNEL);
+ n = kmalloc_obj(*n, GFP_KERNEL);
if (!n)
return -ENOMEM;
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index 22d4f9ff3ae2..ef5dca1313b2 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -341,9 +341,8 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
/* Allocate cluster boot configuration structs */
nclusters = mips_cps_numclusters();
- mips_cps_cluster_bootcfg = kcalloc(nclusters,
- sizeof(*mips_cps_cluster_bootcfg),
- GFP_KERNEL);
+ mips_cps_cluster_bootcfg = kzalloc_objs(*mips_cps_cluster_bootcfg,
+ nclusters, GFP_KERNEL);
if (!mips_cps_cluster_bootcfg)
goto err_out;
@@ -353,8 +352,7 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
for (cl = 0; cl < nclusters; cl++) {
/* Allocate core boot configuration structs */
ncores = mips_cps_numcores(cl);
- core_bootcfg = kcalloc(ncores, sizeof(*core_bootcfg),
- GFP_KERNEL);
+ core_bootcfg = kzalloc_objs(*core_bootcfg, ncores, GFP_KERNEL);
if (!core_bootcfg)
goto err_out;
mips_cps_cluster_bootcfg[cl].core_config = core_bootcfg;
@@ -369,9 +367,9 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
for (c = 0; c < ncores; c++) {
int v;
core_vpes = core_vpe_count(cl, c);
- core_bootcfg[c].vpe_config = kcalloc(core_vpes,
- sizeof(*core_bootcfg[c].vpe_config),
- GFP_KERNEL);
+ core_bootcfg[c].vpe_config = kzalloc_objs(*core_bootcfg[c].vpe_config,
+ core_vpes,
+ GFP_KERNEL);
for (v = 0; v < core_vpes; v++)
cpumask_set_cpu(nvpe++, &mips_cps_cluster_bootcfg[cl].cpumask);
if (!core_bootcfg[c].vpe_config)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 2b67c44adab9..fdbb5c4de834 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -94,7 +94,7 @@ struct vpe *alloc_vpe(int minor)
{
struct vpe *v;
- v = kzalloc(sizeof(struct vpe), GFP_KERNEL);
+ v = kzalloc_obj(struct vpe, GFP_KERNEL);
if (v == NULL)
goto out;
@@ -115,7 +115,7 @@ struct tc *alloc_tc(int index)
{
struct tc *tc;
- tc = kzalloc(sizeof(struct tc), GFP_KERNEL);
+ tc = kzalloc_obj(struct tc, GFP_KERNEL);
if (tc == NULL)
goto out;
@@ -318,7 +318,7 @@ static int apply_r_mips_hi16(struct module *me, uint32_t *location,
* the carry we need to add. Save the information, and let LO16 do the
* actual relocation.
*/
- n = kmalloc(sizeof(*n), GFP_KERNEL);
+ n = kmalloc_obj(*n, GFP_KERNEL);
if (!n)
return -ENOMEM;
diff --git a/arch/mips/lantiq/falcon/sysctrl.c b/arch/mips/lantiq/falcon/sysctrl.c
index 577e6e6309a6..ee0e634f6fe1 100644
--- a/arch/mips/lantiq/falcon/sysctrl.c
+++ b/arch/mips/lantiq/falcon/sysctrl.c
@@ -161,7 +161,7 @@ static void falcon_gpe_enable(void)
static inline void clkdev_add_sys(const char *dev, unsigned int module,
unsigned int bits)
{
- struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
+ struct clk *clk = kzalloc_obj(struct clk, GFP_KERNEL);
if (!clk)
return;
diff --git a/arch/mips/lantiq/xway/gptu.c b/arch/mips/lantiq/xway/gptu.c
index 484c9e3000c1..f8f3f5383a34 100644
--- a/arch/mips/lantiq/xway/gptu.c
+++ b/arch/mips/lantiq/xway/gptu.c
@@ -121,7 +121,7 @@ static void gptu_disable(struct clk *clk)
static inline void clkdev_add_gptu(struct device *dev, const char *con,
unsigned int timer)
{
- struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
+ struct clk *clk = kzalloc_obj(struct clk, GFP_KERNEL);
if (!clk)
return;
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index d9aa80afdf9d..b7be6c710a15 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -331,7 +331,7 @@ static int clkout_enable(struct clk *clk)
static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
unsigned int module, unsigned int bits)
{
- struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
+ struct clk *clk = kzalloc_obj(struct clk, GFP_KERNEL);
if (!clk)
return;
@@ -356,7 +356,7 @@ static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
static void clkdev_add_cgu(const char *dev, const char *con,
unsigned int bits)
{
- struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
+ struct clk *clk = kzalloc_obj(struct clk, GFP_KERNEL);
if (!clk)
return;
@@ -374,8 +374,8 @@ static unsigned long valid_pci_rates[] = {CLOCK_33M, CLOCK_62_5M, 0};
static void clkdev_add_pci(void)
{
- struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
- struct clk *clk_ext = kzalloc(sizeof(struct clk), GFP_KERNEL);
+ struct clk *clk = kzalloc_obj(struct clk, GFP_KERNEL);
+ struct clk *clk_ext = kzalloc_obj(struct clk, GFP_KERNEL);
/* main pci clock */
if (clk) {
@@ -423,7 +423,7 @@ static void clkdev_add_clkout(void)
continue;
sprintf(name, "clkout%d", i);
- clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
+ clk = kzalloc_obj(struct clk, GFP_KERNEL);
if (!clk) {
kfree(name);
continue;
diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c
index b9f90f33fc9a..5f73f8663ab2 100644
--- a/arch/mips/loongson64/init.c
+++ b/arch/mips/loongson64/init.c
@@ -156,7 +156,7 @@ static int __init add_legacy_isa_io(struct fwnode_handle *fwnode, resource_size_
struct logic_pio_hwaddr *range;
unsigned long vaddr;
- range = kzalloc(sizeof(*range), GFP_ATOMIC);
+ range = kzalloc_obj(*range, GFP_ATOMIC);
if (!range)
return -ENOMEM;
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c
index 6bfee0f71803..d5b4f0e6bee3 100644
--- a/arch/mips/pci/pci-alchemy.c
+++ b/arch/mips/pci/pci-alchemy.c
@@ -380,7 +380,7 @@ static int alchemy_pci_probe(struct platform_device *pdev)
goto out;
}
- ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+ ctx = kzalloc_obj(*ctx, GFP_KERNEL);
if (!ctx) {
dev_err(&pdev->dev, "no memory for pcictl context\n");
ret = -ENOMEM;
diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
index e00c38620d14..c78f99eebe1a 100644
--- a/arch/mips/pci/pci-xtalk-bridge.c
+++ b/arch/mips/pci/pci-xtalk-bridge.c
@@ -341,7 +341,7 @@ static int bridge_domain_alloc(struct irq_domain *domain, unsigned int virq,
if (nr_irqs > 1 || !info)
return -EINVAL;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data, GFP_KERNEL);
if (!data)
return -ENOMEM;
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
index 672249a13a09..c493fe67802c 100644
--- a/arch/mips/ralink/mt7620.c
+++ b/arch/mips/ralink/mt7620.c
@@ -198,7 +198,7 @@ static int __init mt7620_soc_dev_init(void)
struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr;
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+ soc_dev_attr = kzalloc_obj(*soc_dev_attr, GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c
index 5a9fd3fe41d7..ca70966da6f7 100644
--- a/arch/mips/ralink/mt7621.c
+++ b/arch/mips/ralink/mt7621.c
@@ -144,7 +144,7 @@ static int __init mt7621_soc_dev_init(void)
struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr;
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+ soc_dev_attr = kzalloc_obj(*soc_dev_attr, GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
diff --git a/arch/mips/ralink/rt288x.c b/arch/mips/ralink/rt288x.c
index ce8b5b6025bb..d60fd84e4b9c 100644
--- a/arch/mips/ralink/rt288x.c
+++ b/arch/mips/ralink/rt288x.c
@@ -68,7 +68,7 @@ static int __init rt2880_soc_dev_init(void)
struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr;
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+ soc_dev_attr = kzalloc_obj(*soc_dev_attr, GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c
index 1f422470b029..6abd2a56ba27 100644
--- a/arch/mips/ralink/rt305x.c
+++ b/arch/mips/ralink/rt305x.c
@@ -171,7 +171,7 @@ static int __init rt305x_soc_dev_init(void)
struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr;
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+ soc_dev_attr = kzalloc_obj(*soc_dev_attr, GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
diff --git a/arch/mips/ralink/rt3883.c b/arch/mips/ralink/rt3883.c
index 21ce00da5758..60605941b4b2 100644
--- a/arch/mips/ralink/rt3883.c
+++ b/arch/mips/ralink/rt3883.c
@@ -68,7 +68,7 @@ static int __init rt3883_soc_dev_init(void)
struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr;
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+ soc_dev_attr = kzalloc_obj(*soc_dev_attr, GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index 19b70928d6dc..08604e5836bc 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -361,7 +361,7 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
}
printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
slotno, name, id);
- gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
+ gio_dev = kzalloc_obj(*gio_dev, GFP_KERNEL);
if (!gio_dev)
return;
gio_dev->name = name;
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 20ef663af16e..fb3e9bfa6abf 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -129,7 +129,7 @@ static int hub_domain_alloc(struct irq_domain *domain, unsigned int virq,
if (nr_irqs > 1 || !info)
return -EINVAL;
- hd = kzalloc(sizeof(*hd), GFP_KERNEL);
+ hd = kzalloc_obj(*hd, GFP_KERNEL);
if (!hd)
return -ENOMEM;
diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c
index 5143d1cf8984..5504c3234d5a 100644
--- a/arch/mips/sgi-ip27/ip27-xtalk.c
+++ b/arch/mips/sgi-ip27/ip27-xtalk.c
@@ -34,7 +34,7 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid)
offset = NODE_OFFSET(nasid);
- wd = kzalloc(sizeof(*wd), GFP_KERNEL);
+ wd = kzalloc_obj(*wd, GFP_KERNEL);
if (!wd) {
pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget);
return;
@@ -69,7 +69,7 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid)
/* platform_device_add_data() duplicates the data */
kfree(wd);
- bd = kzalloc(sizeof(*bd), GFP_KERNEL);
+ bd = kzalloc_obj(*bd, GFP_KERNEL);
if (!bd) {
pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget);
goto err_unregister_pdev_wd;
diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c
index 9fb905e2cf14..1ffa97c578fa 100644
--- a/arch/mips/sgi-ip30/ip30-irq.c
+++ b/arch/mips/sgi-ip30/ip30-irq.c
@@ -209,7 +209,7 @@ static int heart_domain_alloc(struct irq_domain *domain, unsigned int virq,
if (nr_irqs > 1 || !info)
return -EINVAL;
- hd = kzalloc(sizeof(*hd), GFP_KERNEL);
+ hd = kzalloc_obj(*hd, GFP_KERNEL);
if (!hd)
return -ENOMEM;
diff --git a/arch/mips/sgi-ip30/ip30-xtalk.c b/arch/mips/sgi-ip30/ip30-xtalk.c
index d798ee8c998c..e5525f1b617e 100644
--- a/arch/mips/sgi-ip30/ip30-xtalk.c
+++ b/arch/mips/sgi-ip30/ip30-xtalk.c
@@ -44,7 +44,7 @@ static void bridge_platform_create(int widget, int masterwid)
struct platform_device *pdev_bd;
struct resource w1_res;
- wd = kzalloc(sizeof(*wd), GFP_KERNEL);
+ wd = kzalloc_obj(*wd, GFP_KERNEL);
if (!wd) {
pr_warn("xtalk:%x bridge create out of memory\n", widget);
return;
@@ -79,7 +79,7 @@ static void bridge_platform_create(int widget, int masterwid)
/* platform_device_add_data() duplicates the data */
kfree(wd);
- bd = kzalloc(sizeof(*bd), GFP_KERNEL);
+ bd = kzalloc_obj(*bd, GFP_KERNEL);
if (!bd) {
pr_warn("xtalk:%x bridge create out of memory\n", widget);
goto err_unregister_pdev_wd;
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index d9249f5a632e..1976c06ee667 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -120,7 +120,7 @@ txx9_alloc_pci_controller(struct pci_controller *pcic,
int min_size = 0x10000;
if (!pcic) {
- new = kzalloc(sizeof(*new), GFP_KERNEL);
+ new = kzalloc_obj(*new, GFP_KERNEL);
if (!new)
return NULL;
new->r_mem[0].name = "PCI mem";
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 03f8a3a95637..5cf490edea5a 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -648,7 +648,7 @@ void __init txx9_iocled_init(unsigned long baseaddr,
if (!deftriggers)
deftriggers = default_triggers;
- iocled = kzalloc(sizeof(*iocled), GFP_KERNEL);
+ iocled = kzalloc_obj(*iocled, GFP_KERNEL);
if (!iocled)
return;
iocled->mmioaddr = ioremap(baseaddr, 1);
@@ -822,7 +822,7 @@ void __init txx9_sramc_init(struct resource *r)
err = subsys_system_register(&txx9_sramc_subsys, NULL);
if (err)
return;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return;
size = resource_size(r);