summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ac.c2
-rw-r--r--drivers/acpi/acpi_apd.c2
-rw-r--r--drivers/acpi/acpi_configfs.c2
-rw-r--r--drivers/acpi/acpi_ipmi.c4
-rw-r--r--drivers/acpi/acpi_lpat.c4
-rw-r--r--drivers/acpi/acpi_memhotplug.c4
-rw-r--r--drivers/acpi/acpi_mrrm.c6
-rw-r--r--drivers/acpi/acpi_pcc.c2
-rw-r--r--drivers/acpi/acpi_platform.c2
-rw-r--r--drivers/acpi/acpi_processor.c2
-rw-r--r--drivers/acpi/acpi_video.c16
-rw-r--r--drivers/acpi/acpi_watchdog.c2
-rw-r--r--drivers/acpi/apei/apei-base.c4
-rw-r--r--drivers/acpi/apei/einj-core.c2
-rw-r--r--drivers/acpi/apei/ghes.c2
-rw-r--r--drivers/acpi/arm64/ffh.c2
-rw-r--r--drivers/acpi/arm64/iort.c8
-rw-r--r--drivers/acpi/button.c2
-rw-r--r--drivers/acpi/container.c2
-rw-r--r--drivers/acpi/cppc_acpi.c5
-rw-r--r--drivers/acpi/dock.c2
-rw-r--r--drivers/acpi/ec.c6
-rw-r--r--drivers/acpi/glue.c2
-rw-r--r--drivers/acpi/ioapic.c2
-rw-r--r--drivers/acpi/mipi-disco-img.c5
-rw-r--r--drivers/acpi/nfit/core.c4
-rw-r--r--drivers/acpi/numa/hmat.c8
-rw-r--r--drivers/acpi/nvs.c4
-rw-r--r--drivers/acpi/osl.c6
-rw-r--r--drivers/acpi/pci_irq.c2
-rw-r--r--drivers/acpi/pci_link.c2
-rw-r--r--drivers/acpi/pci_mcfg.c2
-rw-r--r--drivers/acpi/pci_root.c2
-rw-r--r--drivers/acpi/pci_slot.c2
-rw-r--r--drivers/acpi/platform_profile.c3
-rw-r--r--drivers/acpi/power.c6
-rw-r--r--drivers/acpi/prmt.c2
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/processor_pdc.c4
-rw-r--r--drivers/acpi/processor_perflib.c4
-rw-r--r--drivers/acpi/processor_throttling.c4
-rw-r--r--drivers/acpi/property.c4
-rw-r--r--drivers/acpi/riscv/irq.c10
-rw-r--r--drivers/acpi/riscv/rimt.c2
-rw-r--r--drivers/acpi/sbs.c2
-rw-r--r--drivers/acpi/sbshc.c2
-rw-r--r--drivers/acpi/scan.c15
-rw-r--r--drivers/acpi/sysfs.c12
-rw-r--r--drivers/acpi/thermal.c2
-rw-r--r--drivers/acpi/utils.c2
-rw-r--r--drivers/acpi/viot.c4
-rw-r--r--drivers/acpi/wakeup.c2
-rw-r--r--drivers/acpi/x86/lpss.c2
-rw-r--r--drivers/acpi/x86/s2idle.c10
54 files changed, 105 insertions, 115 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 1f69be8f51a2..c5d77c3cb4bc 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -208,7 +208,7 @@ static int acpi_ac_probe(struct platform_device *pdev)
struct acpi_ac *ac;
int result;
- ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
+ ac = kzalloc_obj(struct acpi_ac);
if (!ac)
return -ENOMEM;
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index 49539f7528c6..bed0791c17fc 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -202,7 +202,7 @@ static int acpi_apd_create_device(struct acpi_device *adev,
return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
}
- pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+ pdata = kzalloc_obj(*pdata);
if (!pdata)
return -ENOMEM;
diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
index c970792b11a4..12ffec795803 100644
--- a/drivers/acpi/acpi_configfs.c
+++ b/drivers/acpi/acpi_configfs.c
@@ -210,7 +210,7 @@ static struct config_item *acpi_table_make_item(struct config_group *group,
{
struct acpi_table *table;
- table = kzalloc(sizeof(*table), GFP_KERNEL);
+ table = kzalloc_obj(*table);
if (!table)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
index 5fba4dab5d08..8f1aeae8b72e 100644
--- a/drivers/acpi/acpi_ipmi.c
+++ b/drivers/acpi/acpi_ipmi.c
@@ -117,7 +117,7 @@ ipmi_dev_alloc(int iface, struct device *dev, acpi_handle handle)
int err;
struct ipmi_user *user;
- ipmi_device = kzalloc(sizeof(*ipmi_device), GFP_KERNEL);
+ ipmi_device = kzalloc_obj(*ipmi_device);
if (!ipmi_device)
return NULL;
@@ -197,7 +197,7 @@ static struct acpi_ipmi_msg *ipmi_msg_alloc(void)
if (!ipmi)
return NULL;
- ipmi_msg = kzalloc(sizeof(struct acpi_ipmi_msg), GFP_KERNEL);
+ ipmi_msg = kzalloc_obj(struct acpi_ipmi_msg);
if (!ipmi_msg) {
acpi_ipmi_dev_put(ipmi);
return NULL;
diff --git a/drivers/acpi/acpi_lpat.c b/drivers/acpi/acpi_lpat.c
index 851f67c96097..6141c9070eca 100644
--- a/drivers/acpi/acpi_lpat.c
+++ b/drivers/acpi/acpi_lpat.c
@@ -104,7 +104,7 @@ struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(acpi_handle
(obj_p->package.count % 2) || (obj_p->package.count < 4))
goto out;
- lpat = kcalloc(obj_p->package.count, sizeof(int), GFP_KERNEL);
+ lpat = kzalloc_objs(int, obj_p->package.count);
if (!lpat)
goto out;
@@ -117,7 +117,7 @@ struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(acpi_handle
lpat[i] = (s64)obj_e->integer.value;
}
- lpat_table = kzalloc(sizeof(*lpat_table), GFP_KERNEL);
+ lpat_table = kzalloc_obj(*lpat_table);
if (!lpat_table) {
kfree(lpat);
goto out;
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d0c1a71007d0..02a472fa85fc 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -80,7 +80,7 @@ acpi_memory_get_resource(struct acpi_resource *resource, void *context)
}
}
- new = kzalloc(sizeof(struct acpi_memory_info), GFP_KERNEL);
+ new = kzalloc_obj(struct acpi_memory_info);
if (!new)
return AE_ERROR;
@@ -290,7 +290,7 @@ static int acpi_memory_device_add(struct acpi_device *device,
if (!device)
return -EINVAL;
- mem_device = kzalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
+ mem_device = kzalloc_obj(struct acpi_memory_device);
if (!mem_device)
return -ENOMEM;
diff --git a/drivers/acpi/acpi_mrrm.c b/drivers/acpi/acpi_mrrm.c
index 6d69554c940e..e99cbda83452 100644
--- a/drivers/acpi/acpi_mrrm.c
+++ b/drivers/acpi/acpi_mrrm.c
@@ -81,8 +81,8 @@ static __init int acpi_parse_mrrm(struct acpi_table_header *table)
return -EINVAL;
}
- mrrm_mem_range_entry = kmalloc_array(mre_count, sizeof(*mrrm_mem_range_entry),
- GFP_KERNEL | __GFP_ZERO);
+ mrrm_mem_range_entry = kmalloc_objs(*mrrm_mem_range_entry, mre_count,
+ GFP_KERNEL | __GFP_ZERO);
if (!mrrm_mem_range_entry)
return -ENOMEM;
@@ -161,7 +161,7 @@ static __init int add_boot_memory_ranges(void)
if (!pkobj)
return -ENOMEM;
- kobjs = kcalloc(mrrm_mem_entry_num, sizeof(*kobjs), GFP_KERNEL);
+ kobjs = kzalloc_objs(*kobjs, mrrm_mem_entry_num);
if (!kobjs) {
kobject_put(pkobj);
return -ENOMEM;
diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
index e3f302b9dee5..438c67189511 100644
--- a/drivers/acpi/acpi_pcc.c
+++ b/drivers/acpi/acpi_pcc.c
@@ -54,7 +54,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
struct pcc_mbox_chan *pcc_chan;
acpi_status ret;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = kzalloc_obj(*data);
if (!data)
return AE_NO_MEMORY;
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 0ec1afc744f5..64199b19ceff 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -145,7 +145,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
if (count > 0) {
struct resource_entry *rentry;
- resources = kcalloc(count, sizeof(*resources), GFP_KERNEL);
+ resources = kzalloc_objs(*resources, count);
if (!resources) {
acpi_dev_free_resource_list(&resource_list);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 85096ce7b658..b34a48068a8d 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -428,7 +428,7 @@ static int acpi_processor_add(struct acpi_device *device,
if (!acpi_device_is_enabled(device))
return -ENODEV;
- pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
+ pr = kzalloc_obj(struct acpi_processor);
if (!pr)
return -ENOMEM;
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 3d6e7306f29a..3fa28f1abca3 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -825,7 +825,7 @@ int acpi_video_get_levels(struct acpi_device *device,
goto out;
}
- br = kzalloc(sizeof(*br), GFP_KERNEL);
+ br = kzalloc_obj(*br);
if (!br) {
result = -ENOMEM;
goto out;
@@ -836,9 +836,8 @@ int acpi_video_get_levels(struct acpi_device *device,
* in order to account for buggy BIOS which don't export the first two
* special levels (see below)
*/
- br->levels = kmalloc_array(obj->package.count + ACPI_VIDEO_FIRST_LEVEL,
- sizeof(*br->levels),
- GFP_KERNEL);
+ br->levels = kmalloc_objs(*br->levels,
+ obj->package.count + ACPI_VIDEO_FIRST_LEVEL);
if (!br->levels) {
result = -ENOMEM;
goto out_free;
@@ -1141,7 +1140,7 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
if (acpi_get_local_u64_address(device->handle, &device_id))
goto exit;
- data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
+ data = kzalloc_obj(struct acpi_video_device);
if (!data) {
dev_dbg(&device->dev, "Cannot attach\n");
return -ENOMEM;
@@ -1330,9 +1329,8 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
acpi_handle_debug(video->device->handle, "Found %d video heads in _DOD\n",
dod->package.count);
- active_list = kcalloc(1 + dod->package.count,
- sizeof(struct acpi_video_enumerated_device),
- GFP_KERNEL);
+ active_list = kzalloc_objs(struct acpi_video_enumerated_device,
+ 1 + dod->package.count);
if (!active_list) {
status = -ENOMEM;
goto out;
@@ -2004,7 +2002,7 @@ static int acpi_video_bus_probe(struct platform_device *pdev)
return -ENODEV;
}
- video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
+ video = kzalloc_obj(struct acpi_video_bus);
if (!video)
return -ENOMEM;
diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
index 709993c535d1..c04f242a6aa2 100644
--- a/drivers/acpi/acpi_watchdog.c
+++ b/drivers/acpi/acpi_watchdog.c
@@ -166,7 +166,7 @@ void __init acpi_watchdog_init(void)
}
}
- resources = kcalloc(nresources, sizeof(*resources), GFP_KERNEL);
+ resources = kzalloc_objs(*resources, nresources);
if (!resources)
goto fail_free_resource_list;
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 9c84f3da7c09..7a06d30bd40e 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -316,7 +316,7 @@ repeat:
if (res_ins)
list_add(&res_ins->list, res_list);
else {
- res_ins = kmalloc(sizeof(*res_ins), GFP_KERNEL);
+ res_ins = kmalloc_obj(*res_ins);
if (!res_ins)
return -ENOMEM;
res_ins->start = start;
@@ -345,7 +345,7 @@ static int apei_res_sub(struct list_head *res_list1,
break;
} else if (res1->end > res2->end &&
res1->start < res2->start) {
- res = kmalloc(sizeof(*res), GFP_KERNEL);
+ res = kmalloc_obj(*res);
if (!res)
return -ENOMEM;
res->start = res2->end;
diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index f5bfdffe1e43..a9248af078f6 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -1021,7 +1021,7 @@ static bool setup_einjv2_component_files(void)
{
char name[32];
- syndrome_data = kcalloc(max_nr_components, sizeof(syndrome_data[0]), GFP_KERNEL);
+ syndrome_data = kzalloc_objs(syndrome_data[0], max_nr_components);
if (!syndrome_data)
return false;
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index f96aede5d9a3..8acd2742bb27 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -272,7 +272,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
unsigned int error_block_length;
int rc;
- ghes = kzalloc(sizeof(*ghes), GFP_KERNEL);
+ ghes = kzalloc_obj(*ghes);
if (!ghes)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/acpi/arm64/ffh.c b/drivers/acpi/arm64/ffh.c
index 877edc6557e9..04380bab193d 100644
--- a/drivers/acpi/arm64/ffh.c
+++ b/drivers/acpi/arm64/ffh.c
@@ -33,7 +33,7 @@ int acpi_ffh_address_space_arch_setup(void *handler_ctxt, void **region_ctxt)
return -EOPNOTSUPP;
}
- ffh_ctxt = kzalloc(sizeof(*ffh_ctxt), GFP_KERNEL);
+ ffh_ctxt = kzalloc_obj(*ffh_ctxt);
if (!ffh_ctxt)
return -ENOMEM;
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index ed827b2fc437..af7a9b2fd5bc 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -56,7 +56,7 @@ static inline int iort_set_fwnode(struct acpi_iort_node *iort_node,
{
struct iort_fwnode *np;
- np = kzalloc(sizeof(struct iort_fwnode), GFP_ATOMIC);
+ np = kzalloc_obj(struct iort_fwnode, GFP_ATOMIC);
if (WARN_ON(!np))
return -ENOMEM;
@@ -165,7 +165,7 @@ int iort_register_domain_token(int trans_id, phys_addr_t base,
{
struct iort_its_msi_chip *its_msi_chip;
- its_msi_chip = kzalloc(sizeof(*its_msi_chip), GFP_KERNEL);
+ its_msi_chip = kzalloc_obj(*its_msi_chip);
if (!its_msi_chip)
return -ENOMEM;
@@ -938,7 +938,7 @@ static struct iommu_iort_rmr_data *iort_rmr_alloc(
u32 *sids_copy;
u64 addr = rmr_desc->base_address, size = rmr_desc->length;
- rmr_data = kmalloc(sizeof(*rmr_data), GFP_KERNEL);
+ rmr_data = kmalloc_obj(*rmr_data);
if (!rmr_data)
return NULL;
@@ -1942,7 +1942,7 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node,
count = ops->dev_count_resources(node);
- r = kcalloc(count, sizeof(*r), GFP_KERNEL);
+ r = kzalloc_objs(*r, count);
if (!r) {
ret = -ENOMEM;
goto dev_put;
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 7a06194d078b..97b05246efab 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -544,7 +544,7 @@ static int acpi_button_probe(struct platform_device *pdev)
lid_init_state == ACPI_BUTTON_LID_INIT_DISABLED)
return -ENODEV;
- button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
+ button = kzalloc_obj(struct acpi_button);
if (!button)
return -ENOMEM;
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 5b7e3b9ae370..f138a433554a 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -52,7 +52,7 @@ static int container_device_attach(struct acpi_device *adev,
if (adev->flags.is_dock_station)
return 0;
- cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
+ cdev = kzalloc_obj(*cdev);
if (!cdev)
return -ENOMEM;
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 0e6ffb188fe7..f0e513e9ed5d 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -636,8 +636,7 @@ static int pcc_data_alloc(int pcc_ss_id)
if (pcc_data[pcc_ss_id]) {
pcc_data[pcc_ss_id]->refcount++;
} else {
- pcc_data[pcc_ss_id] = kzalloc(sizeof(struct cppc_pcc_data),
- GFP_KERNEL);
+ pcc_data[pcc_ss_id] = kzalloc_obj(struct cppc_pcc_data);
if (!pcc_data[pcc_ss_id])
return -ENOMEM;
pcc_data[pcc_ss_id]->refcount++;
@@ -712,7 +711,7 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
out_obj = (union acpi_object *) output.pointer;
- cpc_ptr = kzalloc(sizeof(struct cpc_desc), GFP_KERNEL);
+ cpc_ptr = kzalloc_obj(struct cpc_desc);
if (!cpc_ptr) {
ret = -ENOMEM;
goto out_buf_free;
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 34affbda295e..d7f3a8912e6a 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -73,7 +73,7 @@ static int add_dock_dependent_device(struct dock_station *ds,
{
struct dock_dependent_device *dd;
- dd = kzalloc(sizeof(*dd), GFP_KERNEL);
+ dd = kzalloc_obj(*dd);
if (!dd)
return -ENOMEM;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f7edc664e064..5f63ed120a2c 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1100,7 +1100,7 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
if (!handle && !func)
return -EINVAL;
- handler = kzalloc(sizeof(*handler), GFP_KERNEL);
+ handler = kzalloc_obj(*handler);
if (!handler)
return -ENOMEM;
@@ -1177,7 +1177,7 @@ static struct acpi_ec_query *acpi_ec_create_query(struct acpi_ec *ec, u8 *pval)
struct acpi_ec_query *q;
struct transaction *t;
- q = kzalloc(sizeof (struct acpi_ec_query), GFP_KERNEL);
+ q = kzalloc_obj(struct acpi_ec_query);
if (!q)
return NULL;
@@ -1422,7 +1422,7 @@ static void acpi_ec_free(struct acpi_ec *ec)
static struct acpi_ec *acpi_ec_alloc(void)
{
- struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
+ struct acpi_ec *ec = kzalloc_obj(struct acpi_ec);
if (!ec)
return NULL;
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index a194f30876c5..b1776809279d 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -246,7 +246,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
acpi_dev_get(acpi_dev);
get_device(dev);
- physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
+ physical_node = kzalloc_obj(*physical_node);
if (!physical_node) {
retval = -ENOMEM;
goto err;
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index 6677955b4a8e..533ddd75922b 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -120,7 +120,7 @@ static acpi_status handle_ioapic_add(acpi_handle handle, u32 lvl,
goto exit;
}
- ioapic = kzalloc(sizeof(*ioapic), GFP_KERNEL);
+ ioapic = kzalloc_obj(*ioapic);
if (!ioapic) {
pr_err("cannot allocate memory for new IOAPIC\n");
goto exit;
diff --git a/drivers/acpi/mipi-disco-img.c b/drivers/acpi/mipi-disco-img.c
index 5b85989f96be..ea4bffe3c02d 100644
--- a/drivers/acpi/mipi-disco-img.c
+++ b/drivers/acpi/mipi-disco-img.c
@@ -91,8 +91,7 @@ static acpi_status parse_csi2_resource(struct acpi_resource *res, void *context)
return AE_OK;
}
- conn = kmalloc(struct_size(conn, remote_name, csi2_res_src_length + 1),
- GFP_KERNEL);
+ conn = kmalloc_flex(*conn, remote_name, csi2_res_src_length + 1);
if (!conn)
return AE_OK;
@@ -111,7 +110,7 @@ static struct crs_csi2 *acpi_mipi_add_crs_csi2(acpi_handle handle,
{
struct crs_csi2 *csi2;
- csi2 = kzalloc(sizeof(*csi2), GFP_KERNEL);
+ csi2 = kzalloc_obj(*csi2);
if (!csi2)
return NULL;
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index e19aba02b800..d13264fb9e02 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2271,9 +2271,9 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
{
u16 nr = ndr_desc->num_mappings;
struct nfit_set_info2 *info2 __free(kfree) =
- kcalloc(nr, sizeof(*info2), GFP_KERNEL);
+ kzalloc_objs(*info2, nr);
struct nfit_set_info *info __free(kfree) =
- kcalloc(nr, sizeof(*info), GFP_KERNEL);
+ kzalloc_objs(*info, nr);
struct device *dev = acpi_desc->dev;
struct nd_interleave_set *nd_set;
int i;
diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
index 77a81627aaef..9792dc394756 100644
--- a/drivers/acpi/numa/hmat.c
+++ b/drivers/acpi/numa/hmat.c
@@ -202,7 +202,7 @@ static __init void alloc_memory_initiator(unsigned int cpu_pxm)
if (initiator)
return;
- initiator = kzalloc(sizeof(*initiator), GFP_KERNEL);
+ initiator = kzalloc_obj(*initiator);
if (!initiator)
return;
@@ -217,7 +217,7 @@ static __init struct memory_target *alloc_target(unsigned int mem_pxm)
target = find_mem_target(mem_pxm);
if (!target) {
- target = kzalloc(sizeof(*target), GFP_KERNEL);
+ target = kzalloc_obj(*target);
if (!target)
return NULL;
target->memory_pxm = mem_pxm;
@@ -371,7 +371,7 @@ static __init void hmat_add_locality(struct acpi_hmat_locality *hmat_loc)
{
struct memory_locality *loc;
- loc = kzalloc(sizeof(*loc), GFP_KERNEL);
+ loc = kzalloc_obj(*loc);
if (!loc) {
pr_notice_once("Failed to allocate HMAT locality\n");
return;
@@ -502,7 +502,7 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
if (!target)
return 0;
- tcache = kzalloc(sizeof(*tcache), GFP_KERNEL);
+ tcache = kzalloc_obj(*tcache);
if (!tcache) {
pr_notice_once("Failed to allocate HMAT cache info\n");
return 0;
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
index a2b11069e792..6eaad7dd0241 100644
--- a/drivers/acpi/nvs.c
+++ b/drivers/acpi/nvs.c
@@ -39,7 +39,7 @@ int acpi_nvs_register(__u64 start, __u64 size)
{
struct nvs_region *region;
- region = kmalloc(sizeof(*region), GFP_KERNEL);
+ region = kmalloc_obj(*region);
if (!region)
return -ENOMEM;
region->phys_start = start;
@@ -102,7 +102,7 @@ static int suspend_nvs_register(unsigned long start, unsigned long size)
while (size > 0) {
unsigned int nr_bytes;
- entry = kzalloc(sizeof(struct nvs_page), GFP_KERNEL);
+ entry = kzalloc_obj(struct nvs_page);
if (!entry)
goto Error;
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 05393a7315fe..5b777316b9ac 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -344,7 +344,7 @@ void __iomem __ref
goto out;
}
- map = kzalloc(sizeof(*map), GFP_KERNEL);
+ map = kzalloc_obj(*map);
if (!map) {
mutex_unlock(&acpi_ioremap_lock);
return NULL;
@@ -1117,7 +1117,7 @@ acpi_status acpi_os_execute(acpi_execute_type type,
* having a static work_struct.
*/
- dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
+ dpc = kzalloc_obj(struct acpi_os_dpc, GFP_ATOMIC);
if (!dpc)
return AE_NO_MEMORY;
@@ -1197,7 +1197,7 @@ acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src)
"Scheduling hotplug event %u for deferred handling\n",
src);
- hpw = kmalloc(sizeof(*hpw), GFP_KERNEL);
+ hpw = kmalloc_obj(*hpw);
if (!hpw)
return AE_NO_MEMORY;
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index c416942ff3e2..8558f0ef64e3 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -147,7 +147,7 @@ static int acpi_pci_irq_check_entry(acpi_handle handle, struct pci_dev *dev,
prt->pin + 1 != pin)
return -ENODEV;
- entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
+ entry = kzalloc_obj(struct acpi_prt_entry);
if (!entry)
return -ENOMEM;
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index b91b039a3d20..45bdfd06bd21 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -720,7 +720,7 @@ static int acpi_pci_link_add(struct acpi_device *device,
int result;
int i;
- link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
+ link = kzalloc_obj(struct acpi_pci_link);
if (!link)
return -ENOMEM;
diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c
index 58e10a980114..0782a5d839bf 100644
--- a/drivers/acpi/pci_mcfg.c
+++ b/drivers/acpi/pci_mcfg.c
@@ -304,7 +304,7 @@ static __init int pci_mcfg_parse(struct acpi_table_header *header)
mcfg = (struct acpi_table_mcfg *)header;
mptr = (struct acpi_mcfg_allocation *) &mcfg[1];
- arr = kcalloc(n, sizeof(*arr), GFP_KERNEL);
+ arr = kzalloc_objs(*arr, n);
if (!arr)
return -ENOMEM;
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 9d7f85dadc48..4a882e939525 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -648,7 +648,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
bool hotadd = system_state == SYSTEM_RUNNING;
const char *acpi_hid;
- root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
+ root = kzalloc_obj(struct acpi_pci_root);
if (!root)
return -ENOMEM;
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index 15234b65ea22..33a123074071 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -104,7 +104,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
return AE_OK;
}
- slot = kmalloc(sizeof(*slot), GFP_KERNEL);
+ slot = kmalloc_obj(*slot);
if (!slot)
return AE_OK;
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index ea04a8c69215..79d2e92e5c28 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -560,8 +560,7 @@ struct device *platform_profile_register(struct device *dev, const char *name,
!ops->profile_set || !ops->probe))
return ERR_PTR(-EINVAL);
- struct platform_profile_handler *pprof __free(kfree) = kzalloc(
- sizeof(*pprof), GFP_KERNEL);
+ struct platform_profile_handler *pprof __free(kfree) = kzalloc_obj(*pprof);
if (!pprof)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 7da5ae5594a7..4611159ee734 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -104,7 +104,7 @@ static int acpi_power_resources_list_add(acpi_handle handle,
if (!resource || !list)
return -EINVAL;
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc_obj(*entry);
if (!entry)
return -ENOMEM;
@@ -265,7 +265,7 @@ acpi_power_resource_add_dependent(struct acpi_power_resource *resource,
goto unlock;
}
- dep = kzalloc(sizeof(*dep), GFP_KERNEL);
+ dep = kzalloc_obj(*dep);
if (!dep) {
ret = -ENOMEM;
goto unlock;
@@ -945,7 +945,7 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
if (device)
return device;
- resource = kzalloc(sizeof(*resource), GFP_KERNEL);
+ resource = kzalloc_obj(*resource);
if (!resource)
return NULL;
diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index 7b8b5d2015ec..7f5851371e5f 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -135,7 +135,7 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
goto parse_prmt_out4;
memmove(tm->mmio_info, temp_mmio, mmio_range_size);
} else {
- tm->mmio_info = kmalloc(sizeof(*tm->mmio_info), GFP_KERNEL);
+ tm->mmio_info = kmalloc_obj(*tm->mmio_info);
if (!tm->mmio_info)
goto parse_prmt_out2;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 81f372c64074..f6c72e3a2be1 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -910,7 +910,7 @@ static int acpi_processor_evaluate_lpi(acpi_handle handle,
goto end;
}
- lpi_state = kcalloc(pkg_count, sizeof(*lpi_state), GFP_KERNEL);
+ lpi_state = kzalloc_objs(*lpi_state, pkg_count);
if (!lpi_state) {
ret = -ENOMEM;
goto end;
@@ -1417,7 +1417,7 @@ void acpi_processor_power_init(struct acpi_processor *pr)
if (!pr->flags.power)
return;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev);
if (!dev)
return;
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c
index 994091bd52de..a46bd9876b11 100644
--- a/drivers/acpi/processor_pdc.c
+++ b/drivers/acpi/processor_pdc.c
@@ -32,11 +32,11 @@ static struct acpi_object_list *acpi_processor_alloc_pdc(void)
u32 *buf;
/* allocate and initialize pdc. It will be used later. */
- obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
+ obj_list = kmalloc_obj(struct acpi_object_list);
if (!obj_list)
goto out;
- obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
+ obj = kmalloc_obj(union acpi_object);
if (!obj) {
kfree(obj_list);
goto out;
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 8972446b7162..fdf55c285c9a 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -341,9 +341,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
pr->performance->state_count = pss->package.count;
pr->performance->states =
- kmalloc_array(pss->package.count,
- sizeof(struct acpi_processor_px),
- GFP_KERNEL);
+ kmalloc_objs(struct acpi_processor_px, pss->package.count);
if (!pr->performance->states) {
result = -ENOMEM;
goto end;
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index f9c2bc1d4a3a..c0f92b93747d 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -512,9 +512,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
pr->throttling.state_count = tss->package.count;
pr->throttling.states_tss =
- kmalloc_array(tss->package.count,
- sizeof(struct acpi_processor_tx_tss),
- GFP_KERNEL);
+ kmalloc_objs(struct acpi_processor_tx_tss, tss->package.count);
if (!pr->throttling.states_tss) {
result = -ENOMEM;
goto end;
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 18e90067d567..8ee5a1f0eb48 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -89,7 +89,7 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc,
if (acpi_graph_ignore_port(handle))
return false;
- dn = kzalloc(sizeof(*dn), GFP_KERNEL);
+ dn = kzalloc_obj(*dn);
if (!dn)
return false;
@@ -383,7 +383,7 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid,
{
struct acpi_device_properties *props;
- props = kzalloc(sizeof(*props), GFP_KERNEL);
+ props = kzalloc_obj(*props);
if (props) {
INIT_LIST_HEAD(&props->list);
props->guid = guid;
diff --git a/drivers/acpi/riscv/irq.c b/drivers/acpi/riscv/irq.c
index d9a2154d6c6a..9b88d0993e88 100644
--- a/drivers/acpi/riscv/irq.c
+++ b/drivers/acpi/riscv/irq.c
@@ -136,7 +136,7 @@ static int __init riscv_acpi_register_ext_intc(u32 gsi_base, u32 nr_irqs, u32 nr
{
struct riscv_ext_intc_list *ext_intc_element, *node, *prev;
- ext_intc_element = kzalloc(sizeof(*ext_intc_element), GFP_KERNEL);
+ ext_intc_element = kzalloc_obj(*ext_intc_element);
if (!ext_intc_element)
return -ENOMEM;
@@ -342,7 +342,8 @@ static u32 riscv_acpi_add_prt_dep(acpi_handle handle)
if (entry->source[0]) {
acpi_get_handle(handle, entry->source, &link_handle);
dep_devices.count = 1;
- dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
+ dep_devices.handles = kzalloc_objs(*dep_devices.handles,
+ 1);
if (!dep_devices.handles) {
acpi_handle_err(handle, "failed to allocate memory\n");
continue;
@@ -353,7 +354,8 @@ static u32 riscv_acpi_add_prt_dep(acpi_handle handle)
} else {
gsi_handle = riscv_acpi_get_gsi_handle(entry->source_index);
dep_devices.count = 1;
- dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
+ dep_devices.handles = kzalloc_objs(*dep_devices.handles,
+ 1);
if (!dep_devices.handles) {
acpi_handle_err(handle, "failed to allocate memory\n");
continue;
@@ -382,7 +384,7 @@ static u32 riscv_acpi_add_irq_dep(acpi_handle handle)
riscv_acpi_irq_get_dep(handle, i, &gsi_handle);
i++) {
dep_devices.count = 1;
- dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL);
+ dep_devices.handles = kzalloc_objs(*dep_devices.handles, 1);
if (!dep_devices.handles) {
acpi_handle_err(handle, "failed to allocate memory\n");
continue;
diff --git a/drivers/acpi/riscv/rimt.c b/drivers/acpi/riscv/rimt.c
index 7f423405e5ef..229c4a0d47a3 100644
--- a/drivers/acpi/riscv/rimt.c
+++ b/drivers/acpi/riscv/rimt.c
@@ -45,7 +45,7 @@ static int rimt_set_fwnode(struct acpi_rimt_node *rimt_node,
{
struct rimt_fwnode *np;
- np = kzalloc(sizeof(*np), GFP_ATOMIC);
+ np = kzalloc_obj(*np, GFP_ATOMIC);
if (WARN_ON(!np))
return -ENOMEM;
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 85160e475c97..bbd3938f7b52 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -636,7 +636,7 @@ static int acpi_sbs_probe(struct platform_device *pdev)
int result = 0;
int id;
- sbs = kzalloc(sizeof(struct acpi_sbs), GFP_KERNEL);
+ sbs = kzalloc_obj(struct acpi_sbs);
if (!sbs) {
result = -ENOMEM;
goto end;
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index cb60d1d52e3e..36850831910b 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -254,7 +254,7 @@ static int acpi_smbus_hc_probe(struct platform_device *pdev)
strscpy(acpi_device_name(device), ACPI_SMB_HC_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_SMB_HC_CLASS);
- hc = kzalloc(sizeof(struct acpi_smb_hc), GFP_KERNEL);
+ hc = kzalloc_obj(struct acpi_smb_hc);
if (!hc)
return -ENOMEM;
mutex_init(&hc->lock);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 565a84a7d7bc..dfdd004fb1a9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -757,8 +757,7 @@ int acpi_device_add(struct acpi_device *device)
if (result)
goto err_unlock;
} else {
- acpi_device_bus_id = kzalloc(sizeof(*acpi_device_bus_id),
- GFP_KERNEL);
+ acpi_device_bus_id = kzalloc_obj(*acpi_device_bus_id);
if (!acpi_device_bus_id) {
result = -ENOMEM;
goto err_unlock;
@@ -1330,7 +1329,7 @@ static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id)
{
struct acpi_hardware_id *id;
- id = kmalloc(sizeof(*id), GFP_KERNEL);
+ id = kmalloc_obj(*id);
if (!id)
return;
@@ -1568,7 +1567,7 @@ int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map)
ret = acpi_dev_get_dma_resources(adev, &list);
if (ret > 0) {
- r = kcalloc(ret + 1, sizeof(*r), GFP_KERNEL);
+ r = kzalloc_objs(*r, ret + 1);
if (!r) {
ret = -ENOMEM;
goto out;
@@ -1863,7 +1862,7 @@ static int acpi_add_single_object(struct acpi_device **child,
bool release_dep_lock = false;
int result;
- device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
+ device = kzalloc_obj(struct acpi_device);
if (!device)
return -ENOMEM;
@@ -2028,7 +2027,7 @@ int acpi_scan_add_dep(acpi_handle handle, struct acpi_handle_list *dep_devices)
if (skip)
continue;
- dep = kzalloc(sizeof(*dep), GFP_KERNEL);
+ dep = kzalloc_obj(*dep);
if (!dep)
continue;
@@ -2225,7 +2224,7 @@ static void acpi_default_enumeration(struct acpi_device *device)
* other device objects have been processed and PCI has claimed
* BARs in case there are resource conflicts.
*/
- sd = kmalloc(sizeof(*sd), GFP_KERNEL);
+ sd = kmalloc_obj(*sd);
if (sd) {
sd->adev = device;
list_add_tail(&sd->node, &acpi_scan_system_dev_list);
@@ -2899,7 +2898,7 @@ void acpi_scan_table_notify(void)
if (!acpi_scan_initialized)
return;
- work = kmalloc(sizeof(*work), GFP_KERNEL);
+ work = kmalloc_obj(*work);
if (!work)
return;
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 1bd2f555e673..a625de3c3c8b 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -385,7 +385,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context)
switch (event) {
case ACPI_TABLE_EVENT_INSTALL:
- table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
+ table_attr = kzalloc_obj(*table_attr);
if (!table_attr)
return AE_NO_MEMORY;
@@ -491,7 +491,7 @@ static int acpi_table_data_init(struct acpi_table_header *th)
for (i = 0; i < NUM_ACPI_DATA_OBJS; i++) {
if (ACPI_COMPARE_NAMESEG(th->signature, acpi_data_objs[i].name)) {
- data_attr = kzalloc(sizeof(*data_attr), GFP_KERNEL);
+ data_attr = kzalloc_obj(*data_attr);
if (!data_attr)
return -ENOMEM;
sysfs_attr_init(&data_attr->attr.attr);
@@ -532,7 +532,7 @@ static int acpi_tables_sysfs_init(void)
if (ACPI_FAILURE(status))
continue;
- table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
+ table_attr = kzalloc_obj(*table_attr);
if (!table_attr)
return -ENOMEM;
@@ -864,11 +864,11 @@ void acpi_irq_stats_init(void)
num_gpes = acpi_current_gpe_count;
num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA;
- all_attrs = kcalloc(num_counters + 1, sizeof(*all_attrs), GFP_KERNEL);
+ all_attrs = kzalloc_objs(*all_attrs, num_counters + 1);
if (all_attrs == NULL)
return;
- all_counters = kcalloc(num_counters, sizeof(*all_counters), GFP_KERNEL);
+ all_counters = kzalloc_objs(*all_counters, num_counters);
if (all_counters == NULL)
goto fail;
@@ -876,7 +876,7 @@ void acpi_irq_stats_init(void)
if (ACPI_FAILURE(status))
goto fail;
- counter_attrs = kcalloc(num_counters, sizeof(*counter_attrs), GFP_KERNEL);
+ counter_attrs = kzalloc_objs(*counter_attrs, num_counters);
if (counter_attrs == NULL)
goto fail;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index e9d3ab18b404..64356b004a57 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -792,7 +792,7 @@ static int acpi_thermal_probe(struct platform_device *pdev)
if (!device)
return -EINVAL;
- tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
+ tz = kzalloc_obj(struct acpi_thermal);
if (!tz)
return -ENOMEM;
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 526563a0d188..6ab27e4826d1 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -365,7 +365,7 @@ bool acpi_evaluate_reference(acpi_handle handle, acpi_string pathname,
goto err;
list->count = package->package.count;
- list->handles = kcalloc(list->count, sizeof(*list->handles), GFP_KERNEL);
+ list->handles = kzalloc_objs(*list->handles, list->count);
if (!list->handles)
goto err_clear;
diff --git a/drivers/acpi/viot.c b/drivers/acpi/viot.c
index c13a20365c2c..c05fcc060e63 100644
--- a/drivers/acpi/viot.c
+++ b/drivers/acpi/viot.c
@@ -142,7 +142,7 @@ static struct viot_iommu * __init viot_get_iommu(unsigned int offset)
if (viot_check_bounds(hdr))
return NULL;
- viommu = kzalloc(sizeof(*viommu), GFP_KERNEL);
+ viommu = kzalloc_obj(*viommu);
if (!viommu)
return NULL;
@@ -193,7 +193,7 @@ static int __init viot_parse_node(const struct acpi_viot_header *hdr)
hdr->type == ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO)
return 0;
- ep = kzalloc(sizeof(*ep), GFP_KERNEL);
+ ep = kzalloc_obj(*ep);
if (!ep)
return -ENOMEM;
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c
index ff6dc957bc11..0cbee0f06f0d 100644
--- a/drivers/acpi/wakeup.c
+++ b/drivers/acpi/wakeup.c
@@ -120,7 +120,7 @@ int acpi_register_wakeup_handler(int wake_irq, bool (*wakeup)(void *context),
if (!acpi_sci_irq_valid() || wake_irq != acpi_sci_irq)
return 0;
- handler = kmalloc(sizeof(*handler), GFP_KERNEL);
+ handler = kmalloc_obj(*handler);
if (!handler)
return -ENOMEM;
diff --git a/drivers/acpi/x86/lpss.c b/drivers/acpi/x86/lpss.c
index 1dcb80ab0d23..0171eef00484 100644
--- a/drivers/acpi/x86/lpss.c
+++ b/drivers/acpi/x86/lpss.c
@@ -623,7 +623,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
if (!dev_desc)
return -EINVAL;
- pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+ pdata = kzalloc_obj(*pdata);
if (!pdata)
return -ENOMEM;
diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index b43d10f986a2..b6b1dd76a06b 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -129,9 +129,8 @@ static void lpi_device_get_constraints_amd(void)
goto free_acpi_buffer;
}
- lpi_constraints_table = kcalloc(package->package.count,
- sizeof(*lpi_constraints_table),
- GFP_KERNEL);
+ lpi_constraints_table = kzalloc_objs(*lpi_constraints_table,
+ package->package.count);
if (!lpi_constraints_table)
goto free_acpi_buffer;
@@ -209,9 +208,8 @@ static void lpi_device_get_constraints(void)
if (!out_obj)
return;
- lpi_constraints_table = kcalloc(out_obj->package.count,
- sizeof(*lpi_constraints_table),
- GFP_KERNEL);
+ lpi_constraints_table = kzalloc_objs(*lpi_constraints_table,
+ out_obj->package.count);
if (!lpi_constraints_table)
goto free_acpi_buffer;