treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family

Mirroring the earlier kmalloc_obj() conversion, convert the
device-managed allocators over to the type-based API using the now
updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived
from the type rather than written out as a sizeof(), and the result is
a pointer to that type rather than void *, so a mismatch between the
size requested and the variable assigned becomes a build error instead
of being silently accepted.

The conversions break down as:

	6713	devm_kzalloc_obj()
	1749	devm_kzalloc_objs()
	 307	devm_kzalloc_flex()
	  91	devm_kmalloc_objs()
	  82	devm_kmalloc_obj()
	   2	devm_kmalloc_flex()

The rules deliberately leave alone allocations sized by a string or a
byte-sized type, or assigned to a pointer to a byte-sized type, since
those are byte buffers rather than objects. Allocations sized by a
multi-byte integer type are only converted when they are assigned to a
pointer to that same type, and allocations of pointers to integers or of
void pointers are left alone too. After this change, 528 files still
call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or
devm_kmalloc_array().

Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390,
m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC
16.2.0 with no new warnings.

Signed-off-by: Kees Cook <[email protected]>
This commit is contained in:
Kees Cook
2026-11-05 21:55:50 -08:00
committed by Kees Cook
parent bcd347f31e
commit 4dd10fbbeb
5975 changed files with 10144 additions and 12235 deletions
+10 -7
View File
@@ -672,18 +672,21 @@ static void arc_pmu_add_raw_event_attr(int j, char *str)
static int arc_pmu_raw_alloc(struct device *dev)
{
arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1,
sizeof(*arc_pmu->attr), GFP_KERNEL | __GFP_ZERO);
arc_pmu->attr = devm_kmalloc_objs(dev, *arc_pmu->attr,
arc_pmu->n_events + 1,
GFP_KERNEL | __GFP_ZERO);
if (!arc_pmu->attr)
return -ENOMEM;
arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1,
sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO);
arc_pmu->attrs = devm_kmalloc_objs(dev, *arc_pmu->attrs,
arc_pmu->n_events + 1,
GFP_KERNEL | __GFP_ZERO);
if (!arc_pmu->attrs)
return -ENOMEM;
arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events,
sizeof(*arc_pmu->raw_entry), GFP_KERNEL | __GFP_ZERO);
arc_pmu->raw_entry = devm_kmalloc_objs(dev, *arc_pmu->raw_entry,
arc_pmu->n_events,
GFP_KERNEL | __GFP_ZERO);
if (!arc_pmu->raw_entry)
return -ENOMEM;
@@ -747,7 +750,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?"))
return -EINVAL;
arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL);
arc_pmu = devm_kzalloc_obj(&pdev->dev, struct arc_pmu);
if (!arc_pmu)
return -ENOMEM;
+1 -1
View File
@@ -800,7 +800,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
if (!pd)
return -EINVAL;
sachip = devm_kzalloc(me, sizeof(struct sa1111), GFP_KERNEL);
sachip = devm_kzalloc_obj(me, struct sa1111);
if (!sachip)
return -ENOMEM;
+1 -1
View File
@@ -219,7 +219,7 @@ static int imx_src_probe(struct platform_device *pdev)
{
struct reset_controller_dev *rcdev;
rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL);
rcdev = devm_kzalloc_obj(&pdev->dev, *rcdev);
if (!rcdev)
return -ENOMEM;
+1 -2
View File
@@ -770,8 +770,7 @@ static int omap_system_dma_probe(struct platform_device *pdev)
dma_chan_count = dma_lch_count;
enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count,
sizeof(*dma_chan), GFP_KERNEL);
dma_chan = devm_kzalloc_objs(&pdev->dev, *dma_chan, dma_lch_count);
if (!dma_chan)
return -ENOMEM;
+1 -1
View File
@@ -413,7 +413,7 @@ static int ar2315_pci_probe(struct platform_device *pdev)
struct resource *res;
int irq, err;
apc = devm_kzalloc(dev, sizeof(*apc), GFP_KERNEL);
apc = devm_kzalloc_obj(dev, *apc);
if (!apc)
return -ENOMEM;
+1 -2
View File
@@ -331,8 +331,7 @@ static int ar71xx_pci_probe(struct platform_device *pdev)
struct resource *res;
u32 t;
apc = devm_kzalloc(&pdev->dev, sizeof(struct ar71xx_pci_controller),
GFP_KERNEL);
apc = devm_kzalloc_obj(&pdev->dev, struct ar71xx_pci_controller);
if (!apc)
return -ENOMEM;
+1 -2
View File
@@ -367,8 +367,7 @@ static int ar724x_pci_probe(struct platform_device *pdev)
if (id == -1)
id = 0;
apc = devm_kzalloc(&pdev->dev, sizeof(struct ar724x_pci_controller),
GFP_KERNEL);
apc = devm_kzalloc_obj(&pdev->dev, struct ar724x_pci_controller);
if (!apc)
return -ENOMEM;
+1 -1
View File
@@ -410,7 +410,7 @@ static int rt3883_pci_probe(struct platform_device *pdev)
int err;
int mode;
rpc = devm_kzalloc(dev, sizeof(*rpc), GFP_KERNEL);
rpc = devm_kzalloc_obj(dev, *rpc);
if (!rpc)
return -ENOMEM;
+1 -1
View File
@@ -102,7 +102,7 @@ static int rt_timer_probe(struct platform_device *pdev)
struct rt_timer *rt;
struct clk *clk;
rt = devm_kzalloc(&pdev->dev, sizeof(*rt), GFP_KERNEL);
rt = devm_kzalloc_obj(&pdev->dev, *rt);
if (!rt) {
dev_err(&pdev->dev, "failed to allocate memory\n");
return -ENOMEM;
@@ -382,8 +382,8 @@ static int get_cs_ranges(struct device *dev)
of_range_parser_init(&parser, lb_node);
lpbfifo.cs_n = of_range_count(&parser);
lpbfifo.cs_ranges = devm_kcalloc(dev, lpbfifo.cs_n,
sizeof(struct cs_range), GFP_KERNEL);
lpbfifo.cs_ranges = devm_kzalloc_objs(dev, struct cs_range,
lpbfifo.cs_n);
if (!lpbfifo.cs_ranges)
goto end;
+1 -1
View File
@@ -713,7 +713,7 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpt_priv *gpt;
gpt = devm_kzalloc(&ofdev->dev, sizeof *gpt, GFP_KERNEL);
gpt = devm_kzalloc_obj(&ofdev->dev, *gpt);
if (!gpt)
return -ENOMEM;
+1 -1
View File
@@ -91,7 +91,7 @@ static int cpm_pic_probe(struct platform_device *pdev)
if (!res)
return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc_obj(dev, *data);
if (!data)
return -ENOMEM;
+2 -2
View File
@@ -491,7 +491,7 @@ int cpm1_gpiochip_add16(struct device *dev)
struct gpio_chip *gc;
u32 mask;
cpm1_gc = devm_kzalloc(dev, sizeof(*cpm1_gc), GFP_KERNEL);
cpm1_gc = devm_kzalloc_obj(dev, *cpm1_gc);
if (!cpm1_gc)
return -ENOMEM;
@@ -635,7 +635,7 @@ int cpm1_gpiochip_add32(struct device *dev)
struct cpm1_gpio32_chip *cpm1_gc;
struct gpio_chip *gc;
cpm1_gc = devm_kzalloc(dev, sizeof(*cpm1_gc), GFP_KERNEL);
cpm1_gc = devm_kzalloc_obj(dev, *cpm1_gc);
if (!cpm1_gc)
return -ENOMEM;
+1 -1
View File
@@ -199,7 +199,7 @@ int cpm2_gpiochip_add32(struct device *dev)
struct cpm2_gpio32_chip *cpm2_gc;
struct gpio_chip *gc;
cpm2_gc = devm_kzalloc(dev, sizeof(*cpm2_gc), GFP_KERNEL);
cpm2_gc = devm_kzalloc_obj(dev, *cpm2_gc);
if (!cpm2_gc)
return -ENOMEM;
+1 -1
View File
@@ -528,7 +528,7 @@ static int grpci1_of_probe(struct platform_device *ofdev)
return -EIO;
}
priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(&ofdev->dev, *priv);
if (!priv) {
dev_err(&ofdev->dev, "memory allocation failed\n");
return -ENOMEM;
+1 -1
View File
@@ -1196,7 +1196,7 @@ virtio_uml_create_pdata(struct platform_device *pdev)
if (!np)
return ERR_PTR(-EINVAL);
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
pdata = devm_kzalloc_obj(&pdev->dev, *pdata);
if (!pdata)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -358,7 +358,7 @@ static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return ret;
}
pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL);
pwr = devm_kzalloc_obj(dev, *pwr);
if (!pwr)
return -ENOMEM;
+1 -1
View File
@@ -439,7 +439,7 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
if (!dev)
return NULL;
engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL);
engine = devm_kzalloc_obj(dev, *engine);
if (!engine)
return NULL;
+2 -2
View File
@@ -1011,7 +1011,7 @@ struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, voi
struct mhi_controller *mhi_cntrl;
int ret;
mhi_cntrl = devm_kzalloc(&pci_dev->dev, sizeof(*mhi_cntrl), GFP_KERNEL);
mhi_cntrl = devm_kzalloc_obj(&pci_dev->dev, *mhi_cntrl);
if (!mhi_cntrl)
return ERR_PTR(-ENOMEM);
@@ -1032,7 +1032,7 @@ struct mhi_controller *qaic_mhi_register_controller(struct pci_dev *pci_dev, voi
mhi_cntrl->regs = mhi_bar;
mhi_cntrl->reg_len = SZ_4K;
mhi_cntrl->nr_irqs = 1;
mhi_cntrl->irq = devm_kmalloc(&pci_dev->dev, sizeof(*mhi_cntrl->irq), GFP_KERNEL);
mhi_cntrl->irq = devm_kmalloc_obj(&pci_dev->dev, *mhi_cntrl->irq);
if (!mhi_cntrl->irq)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -221,7 +221,7 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d
qdev->bootlog_ch = mhi_dev;
for (i = 0; i < BOOTLOG_POOL_SIZE; i++) {
msg = devm_kzalloc(&qdev->pdev->dev, sizeof(*msg), GFP_KERNEL);
msg = devm_kzalloc_obj(&qdev->pdev->dev, *msg);
if (!msg) {
ret = -ENOMEM;
goto mhi_unprepare;
+1 -1
View File
@@ -415,7 +415,7 @@ static struct qaic_device *create_qdev(struct pci_dev *pdev,
struct drm_device *drm;
int i, ret;
qdev = devm_kzalloc(dev, struct_size(qdev, dbc, DBC_NUM), GFP_KERNEL);
qdev = devm_kzalloc_flex(dev, *qdev, dbc, DBC_NUM);
if (!qdev)
return NULL;
+1 -1
View File
@@ -800,7 +800,7 @@ static int sahara_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_device_
int ret;
int i;
context = devm_kzalloc(&mhi_dev->dev, sizeof(*context), GFP_KERNEL);
context = devm_kzalloc_obj(&mhi_dev->dev, *context);
if (!context)
return -ENOMEM;
+1 -1
View File
@@ -33,7 +33,7 @@ struct rocket_device *rocket_device_init(struct platform_device *pdev,
rdev->max_cores = num_cores;
rdev->cores = devm_kcalloc(dev, num_cores, sizeof(*rdev->cores), GFP_KERNEL);
rdev->cores = devm_kzalloc_objs(dev, *rdev->cores, num_cores);
if (!rdev->cores)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -202,7 +202,7 @@ static int acpi_ac_probe(struct platform_device *pdev)
if (!adev)
return -ENODEV;
ac = devm_kzalloc(dev, sizeof(*ac), GFP_KERNEL);
ac = devm_kzalloc_obj(dev, *ac);
if (!ac)
return -ENOMEM;
+1 -1
View File
@@ -72,7 +72,7 @@ static int fch_misc_setup(struct apd_private_data *pdata)
struct list_head resource_list;
int ret;
clk_data = devm_kzalloc(&adev->dev, sizeof(*clk_data), GFP_KERNEL);
clk_data = devm_kzalloc_obj(&adev->dev, *clk_data);
if (!clk_data)
return -ENOMEM;
+1 -1
View File
@@ -853,7 +853,7 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (!(caps & ACPI_TAD_AC_WAKE))
caps &= ~ACPI_TAD_DC_WAKE;
dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
dd = devm_kzalloc_obj(dev, *dd);
if (!dd)
return -ENOMEM;
+1 -1
View File
@@ -112,7 +112,7 @@ static int nvidia_ghes_probe(struct platform_device *pdev)
struct nvidia_ghes_private *priv;
int ret;
priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kmalloc_obj(&pdev->dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -1476,7 +1476,7 @@ static int acpi_battery_probe(struct platform_device *pdev)
if (device->dep_unmet)
return -EPROBE_DEFER;
battery = devm_kzalloc(dev, sizeof(*battery), GFP_KERNEL);
battery = devm_kzalloc_obj(dev, *battery);
if (!battery)
return -ENOMEM;
+1 -1
View File
@@ -687,7 +687,7 @@ static int acpi_button_probe(struct platform_device *pdev)
lid_init_state == ACPI_BUTTON_LID_INIT_DISABLED)
return -ENODEV;
button = devm_kzalloc(dev, sizeof(*button), GFP_KERNEL);
button = devm_kzalloc_obj(dev, *button);
if (!button)
return -ENOMEM;
+2 -2
View File
@@ -115,7 +115,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
return AE_ERROR;
}
event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL);
event = devm_kzalloc_obj(dev, *event);
if (!event)
return AE_ERROR;
@@ -143,7 +143,7 @@ static int ged_probe(struct platform_device *pdev)
struct acpi_ged_device *geddev;
acpi_status acpi_ret;
geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL);
geddev = devm_kzalloc_obj(&pdev->dev, *geddev);
if (!geddev)
return -ENOMEM;
+2 -2
View File
@@ -287,7 +287,7 @@ static int acpi_fan_get_fps(struct device *dev, struct acpi_device *device)
}
fan->fps_count = obj->package.count - 1; /* minus revision field */
fan->fps = devm_kcalloc(dev, fan->fps_count, sizeof(*fan->fps), GFP_KERNEL);
fan->fps = devm_kzalloc_objs(dev, *fan->fps, fan->fps_count);
if (!fan->fps)
return -ENOMEM;
@@ -475,7 +475,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
if (!device)
return -ENODEV;
fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
fan = devm_kzalloc_obj(&pdev->dev, *fan);
if (!fan) {
dev_err(&device->dev, "No memory for fan\n");
return -ENOMEM;
+8 -10
View File
@@ -1060,8 +1060,7 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
if (found)
nfit_mem = found;
else {
nfit_mem = devm_kzalloc(acpi_desc->dev,
sizeof(*nfit_mem), GFP_KERNEL);
nfit_mem = devm_kzalloc_obj(acpi_desc->dev, *nfit_mem);
if (!nfit_mem)
return -ENOMEM;
INIT_LIST_HEAD(&nfit_mem->list);
@@ -1095,10 +1094,9 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
continue;
nfit_mem->nfit_flush = nfit_flush;
flush = nfit_flush->flush;
nfit_mem->flush_wpq = devm_kcalloc(acpi_desc->dev,
flush->hint_count,
sizeof(struct resource),
GFP_KERNEL);
nfit_mem->flush_wpq = devm_kzalloc_objs(acpi_desc->dev,
struct resource,
flush->hint_count);
if (!nfit_mem->flush_wpq)
return -ENOMEM;
for (i = 0; i < flush->hint_count; i++) {
@@ -2287,7 +2285,7 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
if (!info || !info2)
return -ENOMEM;
nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL);
nd_set = devm_kzalloc_obj(dev, *nd_set);
if (!nd_set)
return -ENOMEM;
import_guid(&nd_set->type_guid, spa->range_guid);
@@ -2541,7 +2539,7 @@ static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc,
if (is_pmem == REGION_INTERSECTS)
return 0;
res = devm_kzalloc(acpi_desc->dev, sizeof(*res), GFP_KERNEL);
res = devm_kzalloc_obj(acpi_desc->dev, *res);
if (!res)
return -ENOMEM;
@@ -3391,7 +3389,7 @@ static int acpi_nfit_probe(struct platform_device *pdev)
return rc;
sz = tbl->length;
acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
acpi_desc = devm_kzalloc_obj(dev, *acpi_desc);
if (!acpi_desc)
return -ENOMEM;
acpi_nfit_desc_init(acpi_desc, dev);
@@ -3456,7 +3454,7 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)
}
if (!acpi_desc) {
acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
acpi_desc = devm_kzalloc_obj(dev, *acpi_desc);
if (!acpi_desc)
return;
acpi_nfit_desc_init(acpi_desc, dev);
+1 -1
View File
@@ -373,7 +373,7 @@ static int acpi_pfrt_log_probe(struct platform_device *pdev)
return -ENODEV;
}
pfrt_log_dev = devm_kzalloc(&pdev->dev, sizeof(*pfrt_log_dev), GFP_KERNEL);
pfrt_log_dev = devm_kzalloc_obj(&pdev->dev, *pfrt_log_dev);
if (!pfrt_log_dev)
return -ENOMEM;
+1 -1
View File
@@ -554,7 +554,7 @@ static int acpi_pfru_probe(struct platform_device *pdev)
return -ENODEV;
}
pfru_dev = devm_kzalloc(&pdev->dev, sizeof(*pfru_dev), GFP_KERNEL);
pfru_dev = devm_kzalloc_obj(&pdev->dev, *pfru_dev);
if (!pfru_dev)
return -ENOMEM;
+1 -1
View File
@@ -262,7 +262,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
if (!handle)
return -ENODEV;
opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL);
opregion = devm_kzalloc_obj(dev, *opregion);
if (!opregion)
return -ENOMEM;
+1 -1
View File
@@ -384,7 +384,7 @@ static int tps68470_pmic_opregion_probe(struct platform_device *pdev)
return -ENODEV;
}
opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL);
opregion = devm_kzalloc_obj(dev, *opregion);
if (!opregion)
return -ENOMEM;
+2 -2
View File
@@ -281,7 +281,7 @@ static int acard_ahci_port_start(struct ata_port *ap)
dma_addr_t mem_dma;
size_t dma_sz, rx_fis_sz;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
@@ -378,7 +378,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
+1 -1
View File
@@ -2931,7 +2931,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
hpriv->flags |= (unsigned long)pi.private_data;
+1 -1
View File
@@ -443,7 +443,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -268,7 +268,7 @@ static int ceva_ahci_probe(struct platform_device *pdev)
enum dev_dma_attr attr;
int rc;
cevapriv = devm_kzalloc(dev, sizeof(*cevapriv), GFP_KERNEL);
cevapriv = devm_kzalloc_obj(dev, *cevapriv);
if (!cevapriv)
return -ENOMEM;
+1 -1
View File
@@ -178,7 +178,7 @@ static int ahci_da850_probe(struct platform_device *pdev)
* getting procedure with the explicitly specified ids.
*/
if (hpriv->n_clks < 2) {
hpriv->clks = devm_kcalloc(dev, 2, sizeof(*hpriv->clks), GFP_KERNEL);
hpriv->clks = devm_kzalloc_objs(dev, *hpriv->clks, 2);
if (!hpriv->clks)
return -ENOMEM;
+1 -1
View File
@@ -111,7 +111,7 @@ static struct ahci_host_priv *ahci_dwc_get_resources(struct platform_device *pde
struct ahci_dwc_host_priv *dpriv;
struct ahci_host_priv *hpriv;
dpriv = devm_kzalloc(&pdev->dev, sizeof(*dpriv), GFP_KERNEL);
dpriv = devm_kzalloc_obj(&pdev->dev, *dpriv);
if (!dpriv)
return ERR_PTR(-ENOMEM);
+1 -1
View File
@@ -863,7 +863,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
unsigned int reg_val;
int ret;
imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL);
imxpriv = devm_kzalloc_obj(dev, *imxpriv);
if (!imxpriv)
return -ENOMEM;
+1 -1
View File
@@ -129,7 +129,7 @@ static int mtk_ahci_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
int err;
plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
plat = devm_kzalloc_obj(dev, *plat);
if (!plat)
return -ENOMEM;
+1 -1
View File
@@ -274,7 +274,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
if (!(of_id || acpi_id))
return -ENODEV;
qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
qoriq_priv = devm_kzalloc_obj(dev, *qoriq_priv);
if (!qoriq_priv)
return -ENOMEM;
+1 -1
View File
@@ -127,7 +127,7 @@ static const struct ata_port_info *ahci_seattle_get_port_info(
struct seattle_plat_data *plat_data;
u32 val;
plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL);
plat_data = devm_kzalloc_obj(dev, *plat_data);
if (!plat_data)
return &ahci_port_info;
+1 -1
View File
@@ -153,7 +153,7 @@ static int st_ahci_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
int err;
drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL);
drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data);
if (!drv_data)
return -ENOMEM;
+3 -4
View File
@@ -523,7 +523,7 @@ static int tegra_ahci_probe(struct platform_device *pdev)
if (IS_ERR(hpriv))
return PTR_ERR(hpriv);
tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL);
tegra = devm_kzalloc_obj(&pdev->dev, *tegra);
if (!tegra)
return -ENOMEM;
@@ -578,9 +578,8 @@ static int tegra_ahci_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(tegra->pmc),
"failed to get PMC\n");
tegra->supplies = devm_kcalloc(&pdev->dev,
tegra->soc->num_supplies,
sizeof(*tegra->supplies), GFP_KERNEL);
tegra->supplies = devm_kzalloc_objs(&pdev->dev, *tegra->supplies,
tegra->soc->num_supplies);
if (!tegra->supplies)
return -ENOMEM;
+1 -1
View File
@@ -739,7 +739,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
if (IS_ERR(hpriv))
return PTR_ERR(hpriv);
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
ctx = devm_kzalloc_obj(dev, *ctx);
if (!ctx)
return -ENOMEM;
+1 -1
View File
@@ -1855,7 +1855,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
+1 -1
View File
@@ -2514,7 +2514,7 @@ static int ahci_port_start(struct ata_port *ap)
dma_addr_t mem_dma;
size_t dma_sz, rx_fis_sz;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
+1 -1
View File
@@ -539,7 +539,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
* No clock bulk found: fallback to manually getting
* the optional clock.
*/
hpriv->clks = devm_kzalloc(dev, sizeof(*hpriv->clks), GFP_KERNEL);
hpriv->clks = devm_kzalloc_obj(dev, *hpriv->clks);
if (!hpriv->clks) {
rc = -ENOMEM;
goto err_out;
+1 -1
View File
@@ -197,7 +197,7 @@ static int pacpi_port_start(struct ata_port *ap)
if (ACPI_HANDLE(&ap->tdev) == NULL)
return -ENODEV;
acpi = ap->private_data = devm_kzalloc(&pdev->dev, sizeof(struct pata_acpi), GFP_KERNEL);
acpi = ap->private_data = devm_kzalloc_obj(&pdev->dev, struct pata_acpi);
if (ap->private_data == NULL)
return -ENOMEM;
acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]);
+1 -1
View File
@@ -804,7 +804,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
irq_handler_t irq_handler = NULL;
int ret;
acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL);
acdev = devm_kzalloc_obj(&pdev->dev, *acdev);
if (!acdev)
return -ENOMEM;
+1 -1
View File
@@ -340,7 +340,7 @@ static int atp867x_set_priv(struct ata_port *ap)
int port = ap->port_no;
dp = ap->private_data =
devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL);
devm_kzalloc_obj(&pdev->dev, *dp);
if (dp == NULL)
return -ENOMEM;
+1 -1
View File
@@ -153,7 +153,7 @@ static int cmd640_port_start(struct ata_port *ap)
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
struct cmd640_reg *timing;
timing = devm_kzalloc(&pdev->dev, sizeof(struct cmd640_reg), GFP_KERNEL);
timing = devm_kzalloc_obj(&pdev->dev, struct cmd640_reg);
if (timing == NULL)
return -ENOMEM;
timing->last = -1; /* Force a load */
+1 -1
View File
@@ -945,7 +945,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev)
if (IS_ERR(ide_base))
return PTR_ERR(ide_base);
drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL);
drv_data = devm_kzalloc_obj(&pdev->dev, *drv_data);
if (!drv_data)
return -ENOMEM;
+1 -1
View File
@@ -460,7 +460,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
int ret;
int i;
ftide = devm_kzalloc(dev, sizeof(*ftide), GFP_KERNEL);
ftide = devm_kzalloc_obj(dev, *ftide);
if (!ftide)
return -ENOMEM;
ftide->dev = dev;
+1 -1
View File
@@ -489,7 +489,7 @@ static int pata_icside_probe(struct expansion_card *ec,
if (ret)
goto out;
state = devm_kzalloc(&ec->dev, sizeof(*state), GFP_KERNEL);
state = devm_kzalloc_obj(&ec->dev, *state);
if (!state) {
ret = -ENOMEM;
goto release;
+1 -2
View File
@@ -135,8 +135,7 @@ static int pata_imx_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
priv = devm_kzalloc(&pdev->dev,
sizeof(struct pata_imx_priv), GFP_KERNEL);
priv = devm_kzalloc_obj(&pdev->dev, struct pata_imx_priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -746,7 +746,7 @@ static int it821x_port_start(struct ata_port *ap)
if (ret < 0)
return ret;
itdev = devm_kzalloc(&pdev->dev, sizeof(struct it821x_dev), GFP_KERNEL);
itdev = devm_kzalloc_obj(&pdev->dev, struct it821x_dev);
if (itdev == NULL)
return -ENOMEM;
ap->private_data = itdev;
+1 -1
View File
@@ -242,7 +242,7 @@ static int ixp4xx_pata_probe(struct platform_device *pdev)
int ret;
int irq;
ixpp = devm_kzalloc(dev, sizeof(*ixpp), GFP_KERNEL);
ixpp = devm_kzalloc_obj(dev, *ixpp);
if (!ixpp)
return -ENOMEM;
+2 -4
View File
@@ -1146,8 +1146,7 @@ static int pata_macio_attach(struct macio_dev *mdev,
macio_enable_devres(mdev);
/* Allocate and init private data structure */
priv = devm_kzalloc(&mdev->ofdev.dev,
sizeof(struct pata_macio_priv), GFP_KERNEL);
priv = devm_kzalloc_obj(&mdev->ofdev.dev, struct pata_macio_priv);
if (!priv)
return -ENOMEM;
@@ -1288,8 +1287,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
}
/* Allocate and init private data structure */
priv = devm_kzalloc(&pdev->dev,
sizeof(struct pata_macio_priv), GFP_KERNEL);
priv = devm_kzalloc_obj(&pdev->dev, struct pata_macio_priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -737,7 +737,7 @@ static int mpc52xx_ata_probe(struct platform_device *op)
}
/* Prepare our private structure */
priv = devm_kzalloc(&op->dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(&op->dev, *priv);
if (!priv) {
rv = -ENOMEM;
goto err1;
+1 -1
View File
@@ -821,7 +821,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
if (node == NULL)
return -EINVAL;
cf_port = devm_kzalloc(&pdev->dev, sizeof(*cf_port), GFP_KERNEL);
cf_port = devm_kzalloc_obj(&pdev->dev, *cf_port);
if (!cf_port)
return -ENOMEM;
+1 -1
View File
@@ -127,7 +127,7 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res,
return -ENOMEM;
ap = host->ports[0];
ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL);
ap->ops = devm_kzalloc_obj(dev, *ap->ops);
if (!ap->ops)
return -ENOMEM;
ap->ops->inherits = &ata_sff_port_ops;
+1 -2
View File
@@ -244,8 +244,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
/*
* Allocate and load driver's internal data structure
*/
data = devm_kzalloc(&pdev->dev, sizeof(struct pata_pxa_data),
GFP_KERNEL);
data = devm_kzalloc_obj(&pdev->dev, struct pata_pxa_data);
if (!data)
return -ENOMEM;
+1 -1
View File
@@ -130,7 +130,7 @@ static int rb532_pata_driver_probe(struct platform_device *pdev)
if (!ah)
return -ENOMEM;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
info = devm_kzalloc_obj(&pdev->dev, *info);
if (!info)
return -ENOMEM;
+1 -1
View File
@@ -326,7 +326,7 @@ static int rdc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv)
return -ENOMEM;
+1 -1
View File
@@ -435,7 +435,7 @@ static int via_port_start(struct ata_port *ap)
if (ret < 0)
return ret;
vp = devm_kzalloc(&pdev->dev, sizeof(struct via_port), GFP_KERNEL);
vp = devm_kzalloc_obj(&pdev->dev, struct via_port);
if (vp == NULL)
return -ENOMEM;
ap->private_data = vp;
+1 -1
View File
@@ -508,7 +508,7 @@ static int adma_port_start(struct ata_port *ap)
struct adma_port_priv *pp;
adma_enter_reg_mode(ap);
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
pp->pkt = dmam_alloc_coherent(dev, ADMA_PKT_BYTES, &pp->pkt_dma,
+2 -2
View File
@@ -226,7 +226,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
{
struct device *dev = &pdev->dev;
hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL);
hsdev->dma = devm_kzalloc_obj(dev, *hsdev->dma);
if (!hsdev->dma)
return -ENOMEM;
@@ -1129,7 +1129,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
/* Allocate DWC SATA device */
host = ata_host_alloc_pinfo(dev, ppi, SATA_DWC_MAX_PORTS);
hsdev = devm_kzalloc(dev, sizeof(*hsdev), GFP_KERNEL);
hsdev = devm_kzalloc_obj(dev, *hsdev);
if (!host || !hsdev)
return -ENOMEM;
+1 -1
View File
@@ -293,7 +293,7 @@ static int gemini_sata_probe(struct platform_device *pdev)
u32 gmask;
int ret;
sg = devm_kzalloc(dev, sizeof(*sg), GFP_KERNEL);
sg = devm_kzalloc_obj(dev, *sg);
if (!sg)
return -ENOMEM;
sg->dev = dev;
+2 -2
View File
@@ -473,12 +473,12 @@ static int ahci_highbank_probe(struct platform_device *pdev)
if (!irq)
return -EINVAL;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(dev, *hpriv);
if (!hpriv) {
dev_err(dev, "can't alloc ahci_host_priv\n");
return -ENOMEM;
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
pdata = devm_kzalloc_obj(dev, *pdata);
if (!pdata) {
dev_err(dev, "can't alloc ecx_plat_data\n");
return -ENOMEM;
+5 -9
View File
@@ -1675,7 +1675,7 @@ static int mv_port_start(struct ata_port *ap)
unsigned long flags;
int tag;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
ap->private_data = pp;
@@ -4067,18 +4067,14 @@ static int mv_platform_probe(struct platform_device *pdev)
return irq;
host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!host || !hpriv)
return -ENOMEM;
hpriv->port_clks = devm_kcalloc(&pdev->dev,
n_ports, sizeof(struct clk *),
GFP_KERNEL);
hpriv->port_clks = devm_kzalloc_objs(&pdev->dev, struct clk *, n_ports);
if (!hpriv->port_clks)
return -ENOMEM;
hpriv->port_phys = devm_kcalloc(&pdev->dev,
n_ports, sizeof(struct phy *),
GFP_KERNEL);
hpriv->port_phys = devm_kzalloc_objs(&pdev->dev, struct phy *, n_ports);
if (!hpriv->port_phys)
return -ENOMEM;
host->private_data = hpriv;
@@ -4361,7 +4357,7 @@ static int mv_pci_init_one(struct pci_dev *pdev,
n_ports = mv_get_hc_count(ppi[0]->flags) * MV_PORTS_PER_HC;
host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!host || !hpriv)
return -ENOMEM;
host->private_data = hpriv;
+3 -3
View File
@@ -1145,7 +1145,7 @@ static int nv_adma_port_start(struct ata_port *ap)
if (rc)
return rc;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
@@ -1960,7 +1960,7 @@ static int nv_swncq_port_start(struct ata_port *ap)
if (rc)
return rc;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
@@ -2376,7 +2376,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!hpriv)
return -ENOMEM;
hpriv->type = type;
+2 -2
View File
@@ -322,7 +322,7 @@ static int pdc_common_port_start(struct ata_port *ap)
if (rc)
return rc;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
@@ -1189,7 +1189,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
dev_err(&pdev->dev, "failed to allocate host\n");
return -ENOMEM;
}
hpriv = devm_kzalloc(&pdev->dev, sizeof *hpriv, GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!hpriv)
return -ENOMEM;
spin_lock_init(&hpriv->hard_reset_lock);
+1 -1
View File
@@ -461,7 +461,7 @@ static int qs_port_start(struct ata_port *ap)
void __iomem *chan = mmio_base + (ap->port_no * 0x4000);
u64 addr;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
pp->pkt = dmam_alloc_coherent(dev, QS_PKT_BYTES, &pp->pkt_dma,
+1 -1
View File
@@ -867,7 +867,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL);
priv = devm_kzalloc_obj(dev, struct sata_rcar_priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -1199,7 +1199,7 @@ static int sil24_port_start(struct ata_port *ap)
size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS;
dma_addr_t cb_dma;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
+2 -2
View File
@@ -284,7 +284,7 @@ static int pdc_port_start(struct ata_port *ap)
struct device *dev = ap->host->dev;
struct pdc_port_priv *pp;
pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
pp = devm_kzalloc_obj(dev, *pp);
if (!pp)
return -ENOMEM;
@@ -1402,7 +1402,7 @@ static int pdc_sata_init_one(struct pci_dev *pdev,
/* allocate host */
host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!host || !hpriv)
return -ENOMEM;
+1 -1
View File
@@ -150,7 +150,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!host)
return -ENOMEM;
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!hpriv)
return -ENOMEM;
host->private_data = hpriv;
+1 -1
View File
@@ -742,7 +742,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
return rc;
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
hpriv = devm_kzalloc_obj(&pdev->dev, *hpriv);
if (!hpriv)
return -ENOMEM;
host->private_data = hpriv;
+1 -1
View File
@@ -258,7 +258,7 @@ static int __init charlcd_probe(struct platform_device *pdev)
int ret;
struct charlcd *lcd;
lcd = devm_kzalloc(dev, sizeof(*lcd), GFP_KERNEL);
lcd = devm_kzalloc_obj(dev, *lcd);
if (!lcd)
return -ENOMEM;
+1 -1
View File
@@ -663,7 +663,7 @@ static int ht16k33_probe(struct i2c_client *client)
return -EIO;
}
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -232,7 +232,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev)
struct img_ascii_lcd_ctx *ctx;
int err;
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
ctx = devm_kzalloc_obj(dev, *ctx);
if (!ctx)
return -ENOMEM;
+1 -1
View File
@@ -119,7 +119,7 @@ static int max6959_i2c_probe(struct i2c_client *client)
struct max6959_priv *priv;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -63,7 +63,7 @@ static int seg_led_probe(struct platform_device *pdev)
struct seg_led_priv *priv;
struct device *dev = &pdev->dev;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc_obj(dev, *priv);
if (!priv)
return -ENOMEM;
+1 -1
View File
@@ -27,7 +27,7 @@ int pinctrl_bind_pins(struct device *dev)
if (dev_of_node_reused(dev))
return 0;
dev->pins = devm_kzalloc(dev, sizeof(*(dev->pins)), GFP_KERNEL);
dev->pins = devm_kzalloc_obj(dev, *(dev->pins));
if (!dev->pins)
return -ENOMEM;
+1 -1
View File
@@ -214,7 +214,7 @@ regmap_sdw_mbq_gen_context(struct device *dev,
{
struct regmap_mbq_context *ctx;
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
ctx = devm_kzalloc_obj(dev, *ctx);
if (!ctx)
return ERR_PTR(-ENOMEM);
+2 -3
View File
@@ -1237,8 +1237,7 @@ static void regmap_field_init(struct regmap_field *rm_field,
struct regmap_field *devm_regmap_field_alloc(struct device *dev,
struct regmap *regmap, struct reg_field reg_field)
{
struct regmap_field *rm_field = devm_kzalloc(dev,
sizeof(*rm_field), GFP_KERNEL);
struct regmap_field *rm_field = devm_kzalloc_obj(dev, *rm_field);
if (!rm_field)
return ERR_PTR(-ENOMEM);
@@ -1306,7 +1305,7 @@ int devm_regmap_field_bulk_alloc(struct device *dev,
struct regmap_field *rf;
int i;
rf = devm_kcalloc(dev, num_fields, sizeof(*rf), GFP_KERNEL);
rf = devm_kzalloc_objs(dev, *rf, num_fields);
if (!rf)
return -ENOMEM;
+1 -1
View File
@@ -208,7 +208,7 @@ static int bcma_host_soc_probe(struct platform_device *pdev)
int err;
/* Alloc */
bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL);
bus = devm_kzalloc_obj(dev, *bus);
if (!bus)
return -ENOMEM;
+1 -1
View File
@@ -161,7 +161,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id
if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;
data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc_obj(&intf->dev, *data);
if (!data)
return -ENOMEM;
+1 -1
View File
@@ -649,7 +649,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
}
/* Initialize control structure and load firmware */
data = devm_kzalloc(&intf->dev, sizeof(struct bfusb_data), GFP_KERNEL);
data = devm_kzalloc_obj(&intf->dev, struct bfusb_data);
if (!data)
return -ENOMEM;
+1 -1
View File
@@ -376,7 +376,7 @@ static int bpa10x_probe(struct usb_interface *intf,
if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV;
data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc_obj(&intf->dev, *data);
if (!data)
return -ENOMEM;
+2 -3
View File
@@ -225,8 +225,7 @@ static int btintel_pcie_alloc_dbgc_buf(struct btintel_pcie_data *data,
struct data_buf *b;
int i;
*buf = devm_kcalloc(&data->pdev->dev, buf_count,
sizeof(**buf), GFP_KERNEL);
*buf = devm_kzalloc_objs(&data->pdev->dev, **buf, buf_count);
if (!*buf) {
BT_ERR("Failed to allocate dbgc buf: %u", buf_index + 1);
return -ENOMEM;
@@ -4061,7 +4060,7 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
if (!pdev)
return -ENODEV;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc_obj(&pdev->dev, *data);
if (!data)
return -ENOMEM;
+2 -3
View File
@@ -81,8 +81,7 @@ static int btmrvl_sdio_probe_of(struct device *dev,
card->plt_of_node = dev->of_node;
card->plt_wake_cfg = devm_kzalloc(dev, sizeof(*card->plt_wake_cfg),
GFP_KERNEL);
card->plt_wake_cfg = devm_kzalloc_obj(dev, *card->plt_wake_cfg);
cfg = card->plt_wake_cfg;
if (cfg && card->plt_of_node) {
cfg->irq_bt = irq_of_parse_and_map(card->plt_of_node, 0);
@@ -1517,7 +1516,7 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
id->vendor, id->device, id->class, func->num);
card = devm_kzalloc(&func->dev, sizeof(*card), GFP_KERNEL);
card = devm_kzalloc_obj(&func->dev, *card);
if (!card)
return -ENOMEM;
+1 -1
View File
@@ -1418,7 +1418,7 @@ static int btmtksdio_probe(struct sdio_func *func,
bool restore_node;
int err;
bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL);
bdev = devm_kzalloc_obj(&func->dev, *bdev);
if (!bdev)
return -ENOMEM;
+1 -1
View File
@@ -849,7 +849,7 @@ static int btmtkuart_probe(struct serdev_device *serdev)
struct hci_dev *hdev;
int err;
bdev = devm_kzalloc(&serdev->dev, sizeof(*bdev), GFP_KERNEL);
bdev = devm_kzalloc_obj(&serdev->dev, *bdev);
if (!bdev)
return -ENOMEM;
+1 -1
View File
@@ -1847,7 +1847,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
bdaddr_t ba = {0};
int err;
nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL);
nxpdev = devm_kzalloc_obj(&serdev->dev, *nxpdev);
if (!nxpdev)
return -ENOMEM;

Some files were not shown because too many files have changed in this diff Show More