diff options
Diffstat (limited to 'drivers/platform')
73 files changed, 170 insertions, 166 deletions
diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c b/drivers/platform/arm64/huawei-gaokun-ec.c index 7170f8eb76f7..23a727bb230c 100644 --- a/drivers/platform/arm64/huawei-gaokun-ec.c +++ b/drivers/platform/arm64/huawei-gaokun-ec.c @@ -680,7 +680,7 @@ static int gaokun_aux_init(struct device *parent, const char *name, struct auxiliary_device *adev; int ret; - adev = kzalloc(sizeof(*adev), GFP_KERNEL); + adev = kzalloc_obj(*adev, GFP_KERNEL); if (!adev) return -ENOMEM; diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 0b92047265de..7a019827afa5 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -807,9 +807,8 @@ chromeos_laptop_prepare_acpi_peripherals(struct chromeos_laptop *cros_laptop, if (!n_peripherals) return 0; - acpi_peripherals = kcalloc(n_peripherals, - sizeof(*src->acpi_peripherals), - GFP_KERNEL); + acpi_peripherals = kzalloc_objs(*src->acpi_peripherals, n_peripherals, + GFP_KERNEL); if (!acpi_peripherals) return -ENOMEM; @@ -881,7 +880,7 @@ chromeos_laptop_prepare(const struct chromeos_laptop *src) struct chromeos_laptop *cros_laptop; int error; - cros_laptop = kzalloc(sizeof(*cros_laptop), GFP_KERNEL); + cros_laptop = kzalloc_obj(*cros_laptop, GFP_KERNEL); if (!cros_laptop) return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index c9d80ad5b57e..a2c919caa220 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -162,7 +162,7 @@ static int cros_ec_chardev_open(struct inode *inode, struct file *filp) struct chardev_priv *priv; int ret; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = kzalloc_obj(*priv, GFP_KERNEL); if (!priv) return -ENOMEM; diff --git a/drivers/platform/chrome/wilco_ec/event.c b/drivers/platform/chrome/wilco_ec/event.c index 196e46a1d489..e7f85d6f29f1 100644 --- a/drivers/platform/chrome/wilco_ec/event.c +++ b/drivers/platform/chrome/wilco_ec/event.c @@ -106,7 +106,7 @@ static struct ec_event_queue *event_queue_new(int capacity) { struct ec_event_queue *q; - q = kzalloc(struct_size(q, entries, capacity), GFP_KERNEL); + q = kzalloc_flex(*q, entries, capacity, GFP_KERNEL); if (!q) return NULL; @@ -457,7 +457,7 @@ static int event_device_add(struct acpi_device *adev) return error; } - dev_data = kzalloc(sizeof(*dev_data), GFP_KERNEL); + dev_data = kzalloc_obj(*dev_data, GFP_KERNEL); if (!dev_data) { error = -ENOMEM; goto free_minor; diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c index b18043e31ae4..6375bbb6d6ce 100644 --- a/drivers/platform/chrome/wilco_ec/telemetry.c +++ b/drivers/platform/chrome/wilco_ec/telemetry.c @@ -248,7 +248,7 @@ static int telem_open(struct inode *inode, struct file *filp) get_device(&dev_data->dev); - sess_data = kzalloc(sizeof(*sess_data), GFP_KERNEL); + sess_data = kzalloc_obj(*sess_data, GFP_KERNEL); if (!sess_data) { atomic_set(&dev_data->available, 1); return -ENOMEM; @@ -370,7 +370,7 @@ static int telem_device_probe(struct platform_device *pdev) return error; } - dev_data = kzalloc(sizeof(*dev_data), GFP_KERNEL); + dev_data = kzalloc_obj(*dev_data, GFP_KERNEL); if (!dev_data) { ida_free(&telem_ida, minor); return -ENOMEM; diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index abc31971fe6a..370259ef3bfe 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -660,7 +660,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev *dev) */ u32 new_capacity = 2 * dev->pipes_capacity; struct goldfish_pipe **pipes = - kcalloc(new_capacity, sizeof(*pipes), GFP_ATOMIC); + kzalloc_objs(*pipes, new_capacity, GFP_ATOMIC); if (!pipes) return -ENOMEM; memcpy(pipes, dev->pipes, sizeof(*pipes) * dev->pipes_capacity); @@ -699,7 +699,7 @@ static int goldfish_pipe_open(struct inode *inode, struct file *file) int status; /* Allocate new pipe kernel object */ - struct goldfish_pipe *pipe = kzalloc(sizeof(*pipe), GFP_KERNEL); + struct goldfish_pipe *pipe = kzalloc_obj(*pipe, GFP_KERNEL); if (!pipe) return -ENOMEM; @@ -826,8 +826,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev, dev->pdev_dev = &pdev->dev; dev->first_signalled_pipe = NULL; dev->pipes_capacity = INITIAL_PIPES_CAPACITY; - dev->pipes = kcalloc(dev->pipes_capacity, sizeof(*dev->pipes), - GFP_KERNEL); + dev->pipes = kzalloc_objs(*dev->pipes, dev->pipes_capacity, GFP_KERNEL); if (!dev->pipes) { misc_deregister(&dev->miscdev); return -ENOMEM; diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c index 14aa87b39be5..7fea80d3220c 100644 --- a/drivers/platform/mellanox/mlxbf-tmfifo.c +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c @@ -1203,7 +1203,7 @@ static int mlxbf_tmfifo_create_vdev(struct device *dev, goto fail; } - tm_vdev = kzalloc(sizeof(*tm_vdev), GFP_KERNEL); + tm_vdev = kzalloc_obj(*tm_vdev, GFP_KERNEL); if (!tm_vdev) { ret = -ENOMEM; goto fail; diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c index 48e9861bb571..6a6f94ee93f4 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -408,7 +408,7 @@ static int olpc_ec_probe(struct platform_device *pdev) if (!ec_driver) return -ENODEV; - ec = kzalloc(sizeof(*ec), GFP_KERNEL); + ec = kzalloc_obj(*ec, GFP_KERNEL); if (!ec) return -ENOMEM; diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c index 6a7b96d3dae6..1e72dc819e2a 100644 --- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c +++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c @@ -358,7 +358,7 @@ int vchiq_initialise(struct vchiq_state *state, struct vchiq_instance **instance __func__, i); } - instance = kzalloc(sizeof(*instance), GFP_KERNEL); + instance = kzalloc_obj(*instance, GFP_KERNEL); if (!instance) { ret = -ENOMEM; goto failed; @@ -618,7 +618,7 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl } } } else { - waiter = kzalloc(sizeof(*waiter), GFP_KERNEL); + waiter = kzalloc_obj(*waiter, GFP_KERNEL); if (!waiter) return -ENOMEM; } @@ -1249,8 +1249,7 @@ vchiq_dump_service_use_state(struct vchiq_state *state) if (!arm_state) return; - service_data = kmalloc_array(MAX_SERVICES, sizeof(*service_data), - GFP_KERNEL); + service_data = kmalloc_objs(*service_data, MAX_SERVICES, GFP_KERNEL); if (!service_data) return; diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_bus.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_bus.c index f50e637d505c..616e05a36918 100644 --- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_bus.c +++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_bus.c @@ -68,7 +68,7 @@ vchiq_device_register(struct device *parent, const char *name) struct vchiq_device *device; int ret; - device = kzalloc(sizeof(*device), GFP_KERNEL); + device = kzalloc_obj(*device, GFP_KERNEL); if (!device) return NULL; diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c index 83de27cfd469..1dac7d1ffaa2 100644 --- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c +++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c @@ -2723,7 +2723,7 @@ vchiq_add_service_internal(struct vchiq_state *state, if (ret) return NULL; - service = kzalloc(sizeof(*service), GFP_KERNEL); + service = kzalloc_obj(*service, GFP_KERNEL); if (!service) return service; diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c index 0f3dde2657d6..18bcb8c133d1 100644 --- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c +++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c @@ -149,7 +149,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance, if (args->is_open && !instance->connected) return -ENOTCONN; - user_service = kmalloc(sizeof(*user_service), GFP_KERNEL); + user_service = kmalloc_obj(*user_service, GFP_KERNEL); if (!user_service) return -ENOMEM; @@ -298,7 +298,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, return -EINVAL; if (args->mode == VCHIQ_BULK_MODE_BLOCKING) { - waiter = kzalloc(sizeof(*waiter), GFP_KERNEL); + waiter = kzalloc_obj(*waiter, GFP_KERNEL); if (!waiter) { ret = -ENOMEM; goto out; @@ -1185,7 +1185,7 @@ static int vchiq_open(struct inode *inode, struct file *file) return -ENOTCONN; } - instance = kzalloc(sizeof(*instance), GFP_KERNEL); + instance = kzalloc_obj(*instance, GFP_KERNEL); if (!instance) return -ENOMEM; diff --git a/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c b/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c index cd073ed3ea2d..79790867c45c 100644 --- a/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c +++ b/drivers/platform/raspberrypi/vchiq-mmal/mmal-vchiq.c @@ -190,7 +190,7 @@ get_msg_context(struct vchiq_mmal_instance *instance) int handle; /* todo: should this be allocated from a pool to avoid kzalloc */ - msg_context = kzalloc(sizeof(*msg_context), GFP_KERNEL); + msg_context = kzalloc_obj(*msg_context, GFP_KERNEL); if (!msg_context) return ERR_PTR(-ENOMEM); @@ -1898,7 +1898,7 @@ int vchiq_mmal_init(struct device *dev, struct vchiq_mmal_instance **out_instanc goto err_shutdown_vchiq; } - instance = kzalloc(sizeof(*instance), GFP_KERNEL); + instance = kzalloc_obj(*instance, GFP_KERNEL); if (!instance) { err = -ENOMEM; diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c index d68d231e716e..dba8ca379385 100644 --- a/drivers/platform/surface/aggregator/bus.c +++ b/drivers/platform/surface/aggregator/bus.c @@ -83,7 +83,7 @@ struct ssam_device *ssam_device_alloc(struct ssam_controller *ctrl, { struct ssam_device *sdev; - sdev = kzalloc(sizeof(*sdev), GFP_KERNEL); + sdev = kzalloc_obj(*sdev, GFP_KERNEL); if (!sdev) return NULL; diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c index a265e667538c..5f1940a186a1 100644 --- a/drivers/platform/surface/aggregator/controller.c +++ b/drivers/platform/surface/aggregator/controller.c @@ -344,7 +344,7 @@ ssam_nf_refcount_inc(struct ssam_nf *nf, struct ssam_event_registry reg, } } - entry = kzalloc(sizeof(*entry), GFP_KERNEL); + entry = kzalloc_obj(*entry, GFP_KERNEL); if (!entry) return ERR_PTR(-ENOMEM); @@ -623,7 +623,7 @@ static struct ssam_event_item *ssam_event_item_alloc(size_t len, gfp_t flags) item->ops.free = __ssam_event_item_free_cached; } else { - item = kzalloc(struct_size(item, event.data, len), flags); + item = kzalloc_flex(*item, event.data, len, flags); if (!item) return NULL; diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c index 82e531023911..9349a1b14ab7 100644 --- a/drivers/platform/surface/aggregator/core.c +++ b/drivers/platform/surface/aggregator/core.c @@ -652,7 +652,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev) } /* Allocate controller. */ - ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); + ctrl = kzalloc_obj(*ctrl, GFP_KERNEL); if (!ctrl) return -ENOMEM; diff --git a/drivers/platform/surface/surface3_power.c b/drivers/platform/surface/surface3_power.c index 1ee5239269ae..b00f52687fa4 100644 --- a/drivers/platform/surface/surface3_power.c +++ b/drivers/platform/surface/surface3_power.c @@ -454,8 +454,7 @@ static int mshw0011_install_space_handler(struct i2c_client *client) if (!adev) return -ENODEV; - data = kzalloc(sizeof(struct mshw0011_handler_data), - GFP_KERNEL); + data = kzalloc_obj(struct mshw0011_handler_data, GFP_KERNEL); if (!data) return -ENOMEM; diff --git a/drivers/platform/surface/surface_aggregator_cdev.c b/drivers/platform/surface/surface_aggregator_cdev.c index bfaa09d1648b..2e4746c700c8 100644 --- a/drivers/platform/surface/surface_aggregator_cdev.c +++ b/drivers/platform/surface/surface_aggregator_cdev.c @@ -154,7 +154,7 @@ static int ssam_cdev_notifier_register(struct ssam_cdev_client *client, u8 tc, i } /* Allocate new notifier. */ - nf = kzalloc(sizeof(*nf), GFP_KERNEL); + nf = kzalloc_obj(*nf, GFP_KERNEL); if (!nf) { mutex_unlock(&client->notifier_lock); return -ENOMEM; @@ -685,7 +685,7 @@ static int ssam_dbg_device_probe(struct platform_device *pdev) if (IS_ERR(ctrl)) return PTR_ERR(ctrl) == -ENODEV ? -EPROBE_DEFER : PTR_ERR(ctrl); - cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); + cdev = kzalloc_obj(*cdev, GFP_KERNEL); if (!cdev) return -ENOMEM; diff --git a/drivers/platform/surface/surface_dtx.c b/drivers/platform/surface/surface_dtx.c index 97ae010069e4..43a8c23b2bf0 100644 --- a/drivers/platform/surface/surface_dtx.c +++ b/drivers/platform/surface/surface_dtx.c @@ -403,7 +403,7 @@ static int surface_dtx_open(struct inode *inode, struct file *file) struct sdtx_client *client; /* Initialize client. */ - client = kzalloc(sizeof(*client), GFP_KERNEL); + client = kzalloc_obj(*client, GFP_KERNEL); if (!client) return -ENOMEM; @@ -1044,7 +1044,7 @@ static struct sdtx_device *sdtx_device_create(struct device *dev, struct ssam_co struct sdtx_device *ddev; int status; - ddev = kzalloc(sizeof(*ddev), GFP_KERNEL); + ddev = kzalloc_obj(*ddev, GFP_KERNEL); if (!ddev) return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c index e652c85c9161..28386780177c 100644 --- a/drivers/platform/surface/surfacepro3_button.c +++ b/drivers/platform/surface/surfacepro3_button.c @@ -199,7 +199,7 @@ static int surface_button_add(struct acpi_device *device) if (!surface_button_check_MSHW0040(device)) return -ENODEV; - button = kzalloc(sizeof(struct surface_button), GFP_KERNEL); + button = kzalloc_obj(struct surface_button, GFP_KERNEL); if (!button) return -ENOMEM; diff --git a/drivers/platform/wmi/core.c b/drivers/platform/wmi/core.c index 1601bf9fe135..de11edb40b04 100644 --- a/drivers/platform/wmi/core.c +++ b/drivers/platform/wmi/core.c @@ -1296,7 +1296,7 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) continue; } - wblock = kzalloc(sizeof(*wblock), GFP_KERNEL); + wblock = kzalloc_obj(*wblock, GFP_KERNEL); if (!wblock) continue; diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c index 3b9b9f30faa3..73c668b840c7 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -141,7 +141,7 @@ static int amd_stb_handle_efr(struct file *filp) u32 fsize; fsize = dev->dram_size - S2D_RSVD_RAM_SPACE; - stb_data_arr = kmalloc(struct_size(stb_data_arr, data, fsize), GFP_KERNEL); + stb_data_arr = kmalloc_flex(*stb_data_arr, data, fsize, GFP_KERNEL); if (!stb_data_arr) return -ENOMEM; @@ -189,7 +189,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp) } fsize = min(num_samples, S2D_TELEMETRY_BYTES_MAX); - stb_data_arr = kmalloc(struct_size(stb_data_arr, data, fsize), GFP_KERNEL); + stb_data_arr = kmalloc_flex(*stb_data_arr, data, fsize, GFP_KERNEL); if (!stb_data_arr) return -ENOMEM; diff --git a/drivers/platform/x86/amd/wbrf.c b/drivers/platform/x86/amd/wbrf.c index dc10d12bc80d..b7556663223a 100644 --- a/drivers/platform/x86/amd/wbrf.c +++ b/drivers/platform/x86/amd/wbrf.c @@ -72,7 +72,9 @@ static int wbrf_record(struct acpi_device *adev, uint8_t action, struct wbrf_ran */ num_of_elements = 2 * num_of_ranges + 2; - union acpi_object *tmp __free(kfree) = kcalloc(num_of_elements, sizeof(*tmp), GFP_KERNEL); + union acpi_object *tmp __free(kfree) = kzalloc_objs(*tmp, + num_of_elements, + GFP_KERNEL); if (!tmp) return -ENOMEM; diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 1417e230edbd..83f4e96ecbc7 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -799,7 +799,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) return -ENODEV; } - gmux_data = kzalloc(sizeof(*gmux_data), GFP_KERNEL); + gmux_data = kzalloc_obj(*gmux_data, GFP_KERNEL); if (!gmux_data) return -ENOMEM; pnp_set_drvdata(pnp, gmux_data); diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c index 9c1a9ad42bc4..9222e645756f 100644 --- a/drivers/platform/x86/asus-armoury.c +++ b/drivers/platform/x86/asus-armoury.c @@ -1005,8 +1005,8 @@ static void init_rog_tunables(void) /* Initialize AC power tunables */ ac_limits = power_data->ac_data; if (ac_limits) { - ac_rog_tunables = kzalloc(sizeof(*asus_armoury.rog_tunables[ASUS_ROG_TUNABLE_AC]), - GFP_KERNEL); + ac_rog_tunables = kzalloc_obj(*asus_armoury.rog_tunables[ASUS_ROG_TUNABLE_AC], + GFP_KERNEL); if (!ac_rog_tunables) goto err_nomem; @@ -1053,8 +1053,8 @@ static void init_rog_tunables(void) /* Initialize DC power tunables */ dc_limits = power_data->dc_data; if (dc_limits) { - dc_rog_tunables = kzalloc(sizeof(*asus_armoury.rog_tunables[ASUS_ROG_TUNABLE_DC]), - GFP_KERNEL); + dc_rog_tunables = kzalloc_obj(*asus_armoury.rog_tunables[ASUS_ROG_TUNABLE_DC], + GFP_KERNEL); if (!dc_rog_tunables) { kfree(ac_rog_tunables); goto err_nomem; diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index a0a411b4f2d6..2b85315b7bd5 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c @@ -1831,7 +1831,7 @@ static int asus_acpi_add(struct acpi_device *device) pr_notice("Asus Laptop Support version %s\n", ASUS_LAPTOP_VERSION); - asus = kzalloc(sizeof(struct asus_laptop), GFP_KERNEL); + asus = kzalloc_obj(struct asus_laptop, GFP_KERNEL); if (!asus) return -ENOMEM; asus->handle = device->handle; diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 275b56d6a09f..93905860fe07 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -5014,7 +5014,7 @@ static int asus_wmi_add(struct platform_device *pdev) int err; u32 result; - asus = kzalloc(sizeof(struct asus_wmi), GFP_KERNEL); + asus = kzalloc_obj(struct asus_wmi, GFP_KERNEL); if (!asus) return -ENOMEM; diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 74d3eb83f56a..bc9e26b94c84 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c @@ -400,7 +400,7 @@ static int cmpc_accel_add_v4(struct acpi_device *acpi) struct input_dev *inputdev; struct cmpc_accel *accel; - accel = kmalloc(sizeof(*accel), GFP_KERNEL); + accel = kmalloc_obj(*accel, GFP_KERNEL); if (!accel) return -ENOMEM; @@ -650,7 +650,7 @@ static int cmpc_accel_add(struct acpi_device *acpi) struct input_dev *inputdev; struct cmpc_accel *accel; - accel = kmalloc(sizeof(*accel), GFP_KERNEL); + accel = kmalloc_obj(*accel, GFP_KERNEL); if (!accel) return -ENOMEM; @@ -964,7 +964,7 @@ static int cmpc_ipml_add(struct acpi_device *acpi) struct ipml200_dev *ipml; struct backlight_properties props; - ipml = kmalloc(sizeof(*ipml), GFP_KERNEL); + ipml = kmalloc_obj(*ipml, GFP_KERNEL); if (ipml == NULL) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platform/x86/dell/dell-smbios-base.c index 444786102f02..dd011e252713 100644 --- a/drivers/platform/x86/dell/dell-smbios-base.c +++ b/drivers/platform/x86/dell/dell-smbios-base.c @@ -495,12 +495,13 @@ static int build_tokens_sysfs(struct platform_device *dev) int ret; int i, j; - token_entries = kcalloc(da_num_tokens, sizeof(*token_entries), GFP_KERNEL); + token_entries = kzalloc_objs(*token_entries, da_num_tokens, GFP_KERNEL); if (!token_entries) return -ENOMEM; /* need to store both location and value + terminator*/ - token_attrs = kcalloc((2 * da_num_tokens) + 1, sizeof(*token_attrs), GFP_KERNEL); + token_attrs = kzalloc_objs(*token_attrs, (2 * da_num_tokens) + 1, + GFP_KERNEL); if (!token_attrs) goto out_allocate_attrs; diff --git a/drivers/platform/x86/dell/dell-wmi-base.c b/drivers/platform/x86/dell/dell-wmi-base.c index 28076929d6af..f2e63be75fb3 100644 --- a/drivers/platform/x86/dell/dell-wmi-base.c +++ b/drivers/platform/x86/dell/dell-wmi-base.c @@ -586,7 +586,7 @@ static void handle_dmi_entry(const struct dmi_header *dm, void *opaque) return; } - keymap = kcalloc(hotkey_num, sizeof(struct key_entry), GFP_KERNEL); + keymap = kzalloc_objs(struct key_entry, hotkey_num, GFP_KERNEL); if (!keymap) { results->err = -ENOMEM; return; @@ -656,13 +656,9 @@ static int dell_wmi_input_setup(struct wmi_device *wdev) goto err_free_dev; } - keymap = kcalloc(dmi_results.keymap_size + - ARRAY_SIZE(dell_wmi_keymap_type_0000) + - ARRAY_SIZE(dell_wmi_keymap_type_0010) + - ARRAY_SIZE(dell_wmi_keymap_type_0011) + - ARRAY_SIZE(dell_wmi_keymap_type_0012) + - 1, - sizeof(struct key_entry), GFP_KERNEL); + keymap = kzalloc_objs(struct key_entry, + dmi_results.keymap_size + ARRAY_SIZE(dell_wmi_keymap_type_0000) + ARRAY_SIZE(dell_wmi_keymap_type_0010) + ARRAY_SIZE(dell_wmi_keymap_type_0011) + ARRAY_SIZE(dell_wmi_keymap_type_0012) + 1, + GFP_KERNEL); if (!keymap) { kfree(dmi_results.keymap); err = -ENOMEM; @@ -773,7 +769,7 @@ static int dell_wmi_events_set_enabled(bool enable) struct calling_interface_buffer *buffer; int ret; - buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL); + buffer = kzalloc_obj(struct calling_interface_buffer, GFP_KERNEL); if (!buffer) return -ENOMEM; buffer->cmd_class = CLASS_INFO; diff --git a/drivers/platform/x86/dell/dell-wmi-privacy.c b/drivers/platform/x86/dell/dell-wmi-privacy.c index 4b65e1655d42..40fe2c4adedb 100644 --- a/drivers/platform/x86/dell/dell-wmi-privacy.c +++ b/drivers/platform/x86/dell/dell-wmi-privacy.c @@ -314,8 +314,8 @@ static int dell_privacy_wmi_probe(struct wmi_device *wdev, const void *context) return -ENOMEM; /* remap the wmi keymap event to new keymap */ - keymap = kcalloc(ARRAY_SIZE(dell_wmi_keymap_type_0012), - sizeof(struct key_entry), GFP_KERNEL); + keymap = kzalloc_objs(struct key_entry, + ARRAY_SIZE(dell_wmi_keymap_type_0012), GFP_KERNEL); if (!keymap) return -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c index fc2f58b4cbc6..c7c55f8fe0a0 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c @@ -119,8 +119,9 @@ int alloc_enum_data(void) wmi_priv.enumeration_instances_count = get_instance_count(DELL_WMI_BIOS_ENUMERATION_ATTRIBUTE_GUID); - wmi_priv.enumeration_data = kcalloc(wmi_priv.enumeration_instances_count, - sizeof(struct enumeration_data), GFP_KERNEL); + wmi_priv.enumeration_data = kzalloc_objs(struct enumeration_data, + wmi_priv.enumeration_instances_count, + GFP_KERNEL); if (!wmi_priv.enumeration_data) { wmi_priv.enumeration_instances_count = 0; ret = -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c index 735248064239..f00a1cbac2f9 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c @@ -123,8 +123,9 @@ int alloc_int_data(void) int ret = 0; wmi_priv.integer_instances_count = get_instance_count(DELL_WMI_BIOS_INTEGER_ATTRIBUTE_GUID); - wmi_priv.integer_data = kcalloc(wmi_priv.integer_instances_count, - sizeof(struct integer_data), GFP_KERNEL); + wmi_priv.integer_data = kzalloc_objs(struct integer_data, + wmi_priv.integer_instances_count, + GFP_KERNEL); if (!wmi_priv.integer_data) { wmi_priv.integer_instances_count = 0; ret = -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c index 3167e06d416e..44ecdcb82d84 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c @@ -143,7 +143,8 @@ int alloc_po_data(void) int ret = 0; wmi_priv.po_instances_count = get_instance_count(DELL_WMI_BIOS_PASSOBJ_ATTRIBUTE_GUID); - wmi_priv.po_data = kcalloc(wmi_priv.po_instances_count, sizeof(struct po_data), GFP_KERNEL); + wmi_priv.po_data = kzalloc_objs(struct po_data, + wmi_priv.po_instances_count, GFP_KERNEL); if (!wmi_priv.po_data) { wmi_priv.po_instances_count = 0; ret = -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c index 0d2c74f8d1aa..9e11c00ad859 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c @@ -108,8 +108,9 @@ int alloc_str_data(void) int ret = 0; wmi_priv.str_instances_count = get_instance_count(DELL_WMI_BIOS_STRING_ATTRIBUTE_GUID); - wmi_priv.str_data = kcalloc(wmi_priv.str_instances_count, - sizeof(struct str_data), GFP_KERNEL); + wmi_priv.str_data = kzalloc_objs(struct str_data, + wmi_priv.str_instances_count, + GFP_KERNEL); if (!wmi_priv.str_data) { wmi_priv.str_instances_count = 0; ret = -ENOMEM; diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c index f5402b714657..577949ee2e23 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c @@ -460,7 +460,7 @@ static int init_bios_attributes(int attr_type, const char *guid) } /* build attribute */ - attr_name_kobj = kzalloc(sizeof(*attr_name_kobj), GFP_KERNEL); + attr_name_kobj = kzalloc_obj(*attr_name_kobj, GFP_KERNEL); if (!attr_name_kobj) { retval = -ENOMEM; goto err_attr_init; diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c index 403df9bd9522..daf5df8cbafc 100644 --- a/drivers/platform/x86/dell/dell_rbu.c +++ b/drivers/platform/x86/dell/dell_rbu.c @@ -111,7 +111,7 @@ static int create_packet(void *data, size_t length) __must_hold(&rbu_data.lock) spin_unlock(&rbu_data.lock); - newpacket = kzalloc(sizeof (struct packet_data), GFP_KERNEL); + newpacket = kzalloc_obj(struct packet_data, GFP_KERNEL); if (!newpacket) { pr_warn("failed to allocate new packet\n"); diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index d1908815f5a2..e42045494b2c 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -1366,7 +1366,7 @@ static int eeepc_acpi_add(struct acpi_device *device) int result; pr_notice(EEEPC_LAPTOP_NAME "\n"); - eeepc = kzalloc(sizeof(struct eeepc_laptop), GFP_KERNEL); + eeepc = kzalloc_obj(struct eeepc_laptop, GFP_KERNEL); if (!eeepc) return -ENOMEM; eeepc->handle = device->handle; diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c index 51e8977d3eb4..bf3d409e5974 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c @@ -588,7 +588,7 @@ static int hp_add_other_attributes(int attr_type) int ret; char *attr_name; - attr_name_kobj = kzalloc(sizeof(*attr_name_kobj), GFP_KERNEL); + attr_name_kobj = kzalloc_obj(*attr_name_kobj, GFP_KERNEL); if (!attr_name_kobj) return -ENOMEM; @@ -711,7 +711,7 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type, } /* build attribute */ - attr_name_kobj = kzalloc(sizeof(*attr_name_kobj), GFP_KERNEL); + attr_name_kobj = kzalloc_obj(*attr_name_kobj, GFP_KERNEL); if (!attr_name_kobj) { ret = -ENOMEM; goto pack_attr_exit; @@ -810,7 +810,7 @@ static int hp_init_bios_buffer_attribute(enum hp_wmi_data_type attr_type, } /* build attribute */ - attr_name_kobj = kzalloc(sizeof(*attr_name_kobj), GFP_KERNEL); + attr_name_kobj = kzalloc_obj(*attr_name_kobj, GFP_KERNEL); if (!attr_name_kobj) { ret = -ENOMEM; goto buff_attr_exit; diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c index f346aad8e9d8..4a09fd32ebc6 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c @@ -94,8 +94,9 @@ int hp_alloc_enumeration_data(void) bioscfg_drv.enumeration_instances_count = hp_get_instance_count(HP_WMI_BIOS_ENUMERATION_GUID); - bioscfg_drv.enumeration_data = kcalloc(bioscfg_drv.enumeration_instances_count, - sizeof(*bioscfg_drv.enumeration_data), GFP_KERNEL); + bioscfg_drv.enumeration_data = kzalloc_objs(*bioscfg_drv.enumeration_data, + bioscfg_drv.enumeration_instances_count, + GFP_KERNEL); if (!bioscfg_drv.enumeration_data) { bioscfg_drv.enumeration_instances_count = 0; return -ENOMEM; diff --git a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c index 63b1fda2be4e..84d522f2b491 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c @@ -109,8 +109,9 @@ static const struct attribute_group integer_attr_group = { int hp_alloc_integer_data(void) { bioscfg_drv.integer_instances_count = hp_get_instance_count(HP_WMI_BIOS_INTEGER_GUID); - bioscfg_drv.integer_data = kcalloc(bioscfg_drv.integer_instances_count, - sizeof(*bioscfg_drv.integer_data), GFP_KERNEL); + bioscfg_drv.integer_data = kzalloc_objs(*bioscfg_drv.integer_data, + bioscfg_drv.integer_instances_count, + GFP_KERNEL); if (!bioscfg_drv.integer_data) { bioscfg_drv.integer_instances_count = 0; diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c index 6a31f47ce3f5..592328280a81 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c @@ -98,9 +98,9 @@ int hp_alloc_ordered_list_data(void) { bioscfg_drv.ordered_list_instances_count = hp_get_instance_count(HP_WMI_BIOS_ORDERED_LIST_GUID); - bioscfg_drv.ordered_list_data = kcalloc(bioscfg_drv.ordered_list_instances_count, - sizeof(*bioscfg_drv.ordered_list_data), - GFP_KERNEL); + bioscfg_drv.ordered_list_data = kzalloc_objs(*bioscfg_drv.ordered_list_data, + bioscfg_drv.ordered_list_instances_count, + GFP_KERNEL); if (!bioscfg_drv.ordered_list_data) { bioscfg_drv.ordered_list_instances_count = 0; return -ENOMEM; diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c index ec79d9d50377..dc7107ff010b 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c @@ -185,8 +185,9 @@ static const struct attribute_group password_attr_group = { int hp_alloc_password_data(void) { bioscfg_drv.password_instances_count = hp_get_instance_count(HP_WMI_BIOS_PASSWORD_GUID); - bioscfg_drv.password_data = kcalloc(bioscfg_drv.password_instances_count, - sizeof(*bioscfg_drv.password_data), GFP_KERNEL); + bioscfg_drv.password_data = kzalloc_objs(*bioscfg_drv.password_data, + bioscfg_drv.password_instances_count, + GFP_KERNEL); if (!bioscfg_drv.password_data) { bioscfg_drv.password_instances_count = 0; return -ENOMEM; diff --git a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c index 7b885d25650c..f0ce4f3e7f20 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c @@ -101,8 +101,9 @@ static const struct attribute_group string_attr_group = { int hp_alloc_string_data(void) { bioscfg_drv.string_instances_count = hp_get_instance_count(HP_WMI_BIOS_STRING_GUID); - bioscfg_drv.string_data = kcalloc(bioscfg_drv.string_instances_count, - sizeof(*bioscfg_drv.string_data), GFP_KERNEL); + bioscfg_drv.string_data = kzalloc_objs(*bioscfg_drv.string_data, + bioscfg_drv.string_instances_count, + GFP_KERNEL); if (!bioscfg_drv.string_data) { bioscfg_drv.string_instances_count = 0; return -ENOMEM; diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c index 8a4c54089ace..64c5543f795d 100644 --- a/drivers/platform/x86/huawei-wmi.c +++ b/drivers/platform/x86/huawei-wmi.c @@ -854,7 +854,7 @@ static __init int huawei_wmi_init(void) struct platform_device *pdev; int err; - huawei_wmi = kzalloc(sizeof(struct huawei_wmi), GFP_KERNEL); + huawei_wmi = kzalloc_obj(struct huawei_wmi, GFP_KERNEL); if (!huawei_wmi) return -ENOMEM; diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index b73e582128c9..1f4f84217d5e 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -125,7 +125,7 @@ static int __init ifs_init(void) if (rdmsrq_safe(MSR_INTEGRITY_CAPS, &msrval)) return -ENODEV; - ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); + ifs_pkg_auth = kmalloc_objs(bool, topology_max_packages(), GFP_KERNEL); if (!ifs_pkg_auth) return -ENOMEM; diff --git a/drivers/platform/x86/intel/int1092/intel_sar.c b/drivers/platform/x86/intel/int1092/intel_sar.c index e526841aff60..568a2722477b 100644 --- a/drivers/platform/x86/intel/int1092/intel_sar.c +++ b/drivers/platform/x86/intel/int1092/intel_sar.c @@ -91,8 +91,8 @@ static acpi_status parse_package(struct wwan_sar_context *context, union acpi_ob item->package.count <= data->total_dev_mode) return AE_ERROR; - data->device_mode_info = kmalloc_array(data->total_dev_mode, - sizeof(struct wwan_device_mode_info), GFP_KERNEL); + data->device_mode_info = kmalloc_objs(struct wwan_device_mode_info, + data->total_dev_mode, GFP_KERNEL); if (!data->device_mode_info) return AE_ERROR; @@ -248,7 +248,7 @@ static int sar_probe(struct platform_device *device) int reg; int result; - context = kzalloc(sizeof(*context), GFP_KERNEL); + context = kzalloc_obj(*context, GFP_KERNEL); if (!context) return -ENOMEM; diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index 1505fc3ef7a8..ec0994bfa9fc 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -107,7 +107,7 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472, int ret; struct gpiod_lookup_table *lookup __free(kfree) = - kzalloc(struct_size(lookup, table, 2), GFP_KERNEL); + kzalloc_flex(*lookup, table, 2, GFP_KERNEL); if (!lookup) return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 0133405697dc..fdbb8b0005f2 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -180,7 +180,8 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) if (!board_data) return dev_err_probe(&client->dev, -ENODEV, "No board-data found for this model\n"); - cells = kcalloc(TPS68470_WIN_MFD_CELL_COUNT, sizeof(*cells), GFP_KERNEL); + cells = kzalloc_objs(*cells, TPS68470_WIN_MFD_CELL_COUNT, + GFP_KERNEL); if (!cells) return -ENOMEM; diff --git a/drivers/platform/x86/intel/pmc/pltdrv.c b/drivers/platform/x86/intel/pmc/pltdrv.c index 3141d6cbc41b..6fcf0f85a8d7 100644 --- a/drivers/platform/x86/intel/pmc/pltdrv.c +++ b/drivers/platform/x86/intel/pmc/pltdrv.c @@ -65,7 +65,7 @@ static int __init pmc_core_platform_init(void) if (!x86_match_cpu(intel_pmc_core_platform_ids)) return -ENODEV; - pmc_core_device = kzalloc(sizeof(*pmc_core_device), GFP_KERNEL); + pmc_core_device = kzalloc_obj(*pmc_core_device, GFP_KERNEL); if (!pmc_core_device) return -ENOMEM; diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c index a4dfca6cac19..2eee7389dcf9 100644 --- a/drivers/platform/x86/intel/pmt/telemetry.c +++ b/drivers/platform/x86/intel/pmt/telemetry.c @@ -107,7 +107,7 @@ static int pmt_telem_add_endpoint(struct intel_vsec_device *ivdev, struct telem_endpoint *ep; /* Endpoint lifetimes are managed by kref, not devres */ - entry->ep = kzalloc(sizeof(*(entry->ep)), GFP_KERNEL); + entry->ep = kzalloc_obj(*(entry->ep), GFP_KERNEL); if (!entry->ep) return -ENOMEM; diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c index 7449873c3d40..33abff1dbe84 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c @@ -89,7 +89,7 @@ static int isst_store_new_cmd(int cmd, u32 cpu, int mbox_cmd_type, u32 param, { struct isst_cmd *sst_cmd; - sst_cmd = kmalloc(sizeof(*sst_cmd), GFP_KERNEL); + sst_cmd = kmalloc_obj(*sst_cmd, GFP_KERNEL); if (!sst_cmd) return -ENOMEM; @@ -425,15 +425,13 @@ static int isst_if_cpu_info_init(void) { int ret; - isst_cpu_info = kcalloc(num_possible_cpus(), - sizeof(*isst_cpu_info), - GFP_KERNEL); + isst_cpu_info = kzalloc_objs(*isst_cpu_info, num_possible_cpus(), + GFP_KERNEL); if (!isst_cpu_info) return -ENOMEM; - isst_pkg_info = kcalloc(topology_max_packages(), - sizeof(*isst_pkg_info), - GFP_KERNEL); + isst_pkg_info = kzalloc_objs(*isst_pkg_info, topology_max_packages(), + GFP_KERNEL); if (!isst_pkg_info) { kfree(isst_cpu_info); return -ENOMEM; diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index 9c078c8acb50..9242e29aac59 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -1603,7 +1603,7 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev) * devm_* allocation here as each partition is a * different device, which can be unbound. */ - tpmi_sst = kzalloc(sizeof(*tpmi_sst), GFP_KERNEL); + tpmi_sst = kzalloc_obj(*tpmi_sst, GFP_KERNEL); if (!tpmi_sst) { ret = -ENOMEM; goto unlock_exit; @@ -1819,9 +1819,8 @@ int tpmi_sst_init(void) goto init_done; } - isst_common.sst_inst = kcalloc(topology_max_packages(), - sizeof(*isst_common.sst_inst), - GFP_KERNEL); + isst_common.sst_inst = kzalloc_objs(*isst_common.sst_inst, + topology_max_packages(), GFP_KERNEL); if (!isst_common.sst_inst) { ret = -ENOMEM; goto init_done; diff --git a/drivers/platform/x86/intel/tpmi_power_domains.c b/drivers/platform/x86/intel/tpmi_power_domains.c index 7d93119a4c30..57c8856fc468 100644 --- a/drivers/platform/x86/intel/tpmi_power_domains.c +++ b/drivers/platform/x86/intel/tpmi_power_domains.c @@ -221,8 +221,9 @@ static int __init tpmi_init(void) if (ret) return ret; - tpmi_power_domain_mask = kcalloc(size_mul(topology_max_packages(), MAX_POWER_DOMAINS), - sizeof(*tpmi_power_domain_mask), GFP_KERNEL); + tpmi_power_domain_mask = kzalloc_objs(*tpmi_power_domain_mask, + size_mul(topology_max_packages(), MAX_POWER_DOMAINS), + GFP_KERNEL); if (!tpmi_power_domain_mask) return -ENOMEM; diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c index 0dfc552b2802..89a90bd90c44 100644 --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c @@ -278,8 +278,8 @@ static int __init intel_uncore_init(void) uncore_max_entries = topology_max_packages() * topology_max_dies_per_package(); - uncore_instances = kcalloc(uncore_max_entries, - sizeof(*uncore_instances), GFP_KERNEL); + uncore_instances = kzalloc_objs(*uncore_instances, uncore_max_entries, + GFP_KERNEL); if (!uncore_instances) return -ENOMEM; diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c index 012d87878afd..b21a9cfabad4 100644 --- a/drivers/platform/x86/intel/vsec.c +++ b/drivers/platform/x86/intel/vsec.c @@ -299,11 +299,11 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he return -EINVAL; } - intel_vsec_dev = kzalloc(sizeof(*intel_vsec_dev), GFP_KERNEL); + intel_vsec_dev = kzalloc_obj(*intel_vsec_dev, GFP_KERNEL); if (!intel_vsec_dev) return -ENOMEM; - res = kcalloc(header->num_entries, sizeof(*res), GFP_KERNEL); + res = kzalloc_objs(*res, header->num_entries, GFP_KERNEL); if (!res) return -ENOMEM; diff --git a/drivers/platform/x86/intel/vsec_tpmi.c b/drivers/platform/x86/intel/vsec_tpmi.c index 7748b5557a18..9614fb8584f2 100644 --- a/drivers/platform/x86/intel/vsec_tpmi.c +++ b/drivers/platform/x86/intel/vsec_tpmi.c @@ -622,11 +622,11 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info, if (!name) return -EOPNOTSUPP; - res = kcalloc(pfs->pfs_header.num_entries, sizeof(*res), GFP_KERNEL); + res = kzalloc_objs(*res, pfs->pfs_header.num_entries, GFP_KERNEL); if (!res) return -ENOMEM; - feature_vsec_dev = kzalloc(sizeof(*feature_vsec_dev), GFP_KERNEL); + feature_vsec_dev = kzalloc_obj(*feature_vsec_dev, GFP_KERNEL); if (!feature_vsec_dev) { kfree(res); return -ENOMEM; diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 3acf6149a9ec..4412e7c2bce0 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c @@ -573,7 +573,7 @@ __intel_scu_ipc_register(struct device *parent, if (ipcdev) return ERR_PTR(-EBUSY); - scu = kzalloc(sizeof(*scu), GFP_KERNEL); + scu = kzalloc_obj(*scu, GFP_KERNEL); if (!scu) return ERR_PTR(-ENOMEM); diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c index 06ac002a1ebc..59703574e8ce 100644 --- a/drivers/platform/x86/lenovo/ideapad-laptop.c +++ b/drivers/platform/x86/lenovo/ideapad-laptop.c @@ -1172,7 +1172,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) return -ENODEV; } - priv->dytc = kzalloc(sizeof(*priv->dytc), GFP_KERNEL); + priv->dytc = kzalloc_obj(*priv->dytc, GFP_KERNEL); if (!priv->dytc) return -ENOMEM; diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86/lenovo/think-lmi.c index c45f0206b4ab..a89f9436a795 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -1593,7 +1593,7 @@ static struct tlmi_pwd_setting *tlmi_create_auth(const char *pwd_type, { struct tlmi_pwd_setting *new_pwd; - new_pwd = kzalloc(sizeof(struct tlmi_pwd_setting), GFP_KERNEL); + new_pwd = kzalloc_obj(struct tlmi_pwd_setting, GFP_KERNEL); if (!new_pwd) return NULL; @@ -1668,7 +1668,7 @@ static int tlmi_analyze(struct wmi_device *wdev) strreplace(item, ',', '\0'); /* Create a setting entry */ - setting = kzalloc(sizeof(*setting), GFP_KERNEL); + setting = kzalloc_obj(*setting, GFP_KERNEL); if (!setting) { ret = -ENOMEM; kfree(item); diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c index 6b0e4b4c485e..9a5b1d793cb9 100644 --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c @@ -873,7 +873,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) BUG_ON(!ibm->acpi); - ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); + ibm->acpi->driver = kzalloc_obj(struct acpi_driver, GFP_KERNEL); if (!ibm->acpi->driver) { pr_err("failed to allocate memory for ibm->acpi->driver\n"); return -ENOMEM; @@ -1197,7 +1197,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id, BUG_ON(id >= TPACPI_RFK_SW_MAX || tpacpi_rfkill_switches[id]); - atp_rfk = kzalloc(sizeof(struct tpacpi_rfk), GFP_KERNEL); + atp_rfk = kzalloc_obj(struct tpacpi_rfk, GFP_KERNEL); if (atp_rfk) atp_rfk->rfkill = rfkill_alloc(name, &tpacpi_pdev->dev, @@ -5817,8 +5817,7 @@ static int __init led_init(struct ibm_init_struct *iibm) if (led_supported == TPACPI_LED_NONE) return -ENODEV; - tpacpi_leds = kcalloc(TPACPI_LED_NUMLEDS, sizeof(*tpacpi_leds), - GFP_KERNEL); + tpacpi_leds = kzalloc_objs(*tpacpi_leds, TPACPI_LED_NUMLEDS, GFP_KERNEL); if (!tpacpi_leds) { pr_err("Out of memory for LED data\n"); return -ENOMEM; diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index 937f1a5b78ed..9990f6b920c5 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -1017,7 +1017,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) */ num_sifr++; - pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL); + pcc = kzalloc_obj(struct pcc_acpi, GFP_KERNEL); if (!pcc) { pr_err("Couldn't allocate mem for pcc"); return -ENOMEM; diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c index 0aa7076bc9cc..3b6edd709543 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -428,7 +428,7 @@ static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, struct platform_device *clkdev; struct pmc_clk_data *clk_data; - clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); + clk_data = kzalloc_obj(*clk_data, GFP_KERNEL); if (!clk_data) return -ENOMEM; diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index 9d43a12db73c..50e337a85135 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c @@ -1671,7 +1671,7 @@ static int __init samsung_init(void) if (!force && !dmi_check_system(samsung_dmi_table)) return -ENODEV; - samsung = kzalloc(sizeof(*samsung), GFP_KERNEL); + samsung = kzalloc_obj(*samsung, GFP_KERNEL); if (!samsung) return -ENOMEM; diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 56beebc38850..a670473b20ab 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -829,7 +829,7 @@ static int sony_nc_handles_setup(struct platform_device *pd) { int i, r, result, arg; - handles = kzalloc(sizeof(*handles), GFP_KERNEL); + handles = kzalloc_obj(*handles, GFP_KERNEL); if (!handles) return -ENOMEM; @@ -1902,7 +1902,7 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd, } } - kbdbl_ctl = kzalloc(sizeof(*kbdbl_ctl), GFP_KERNEL); + kbdbl_ctl = kzalloc_obj(*kbdbl_ctl, GFP_KERNEL); if (!kbdbl_ctl) return -ENOMEM; @@ -2070,7 +2070,7 @@ static int sony_nc_battery_care_setup(struct platform_device *pd, { int ret = 0; - bcare_ctl = kzalloc(sizeof(struct battery_care_control), GFP_KERNEL); + bcare_ctl = kzalloc_obj(struct battery_care_control, GFP_KERNEL); if (!bcare_ctl) return -ENOMEM; @@ -2222,7 +2222,7 @@ static ssize_t sony_nc_thermal_mode_show(struct device *dev, static int sony_nc_thermal_setup(struct platform_device *pd) { int ret = 0; - th_handle = kzalloc(sizeof(struct snc_thermal_ctrl), GFP_KERNEL); + th_handle = kzalloc_obj(struct snc_thermal_ctrl, GFP_KERNEL); if (!th_handle) return -ENOMEM; @@ -2370,7 +2370,7 @@ static int sony_nc_lid_resume_setup(struct platform_device *pd, if (sony_call_snc_handle(handle, 0x0000, &result)) return -EIO; - lid_ctl = kzalloc(sizeof(struct snc_lid_resume_control), GFP_KERNEL); + lid_ctl = kzalloc_obj(struct snc_lid_resume_control, GFP_KERNEL); if (!lid_ctl) return -ENOMEM; @@ -2497,7 +2497,7 @@ static int sony_nc_gfx_switch_setup(struct platform_device *pd, { unsigned int result; - gfxs_ctl = kzalloc(sizeof(struct snc_gfx_switch_control), GFP_KERNEL); + gfxs_ctl = kzalloc_obj(struct snc_gfx_switch_control, GFP_KERNEL); if (!gfxs_ctl) return -ENOMEM; @@ -2576,7 +2576,7 @@ static int sony_nc_highspeed_charging_setup(struct platform_device *pd) return 0; } - hsc_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + hsc_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!hsc_handle) return -ENOMEM; @@ -2642,7 +2642,7 @@ static int sony_nc_lowbatt_setup(struct platform_device *pd) { unsigned int result; - lowbatt_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + lowbatt_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!lowbatt_handle) return -ENOMEM; @@ -2719,11 +2719,11 @@ static int sony_nc_fanspeed_setup(struct platform_device *pd) { unsigned int result; - fan_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + fan_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!fan_handle) return -ENOMEM; - hsf_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + hsf_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!hsf_handle) { result = -ENOMEM; goto out_hsf_handle_alloc; @@ -2823,7 +2823,7 @@ static int sony_nc_usb_charge_setup(struct platform_device *pd) return 0; } - uc_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + uc_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!uc_handle) return -ENOMEM; @@ -2870,7 +2870,7 @@ static int sony_nc_panelid_setup(struct platform_device *pd) { unsigned int result; - panel_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + panel_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!panel_handle) return -ENOMEM; @@ -2925,7 +2925,7 @@ static int sony_nc_smart_conn_setup(struct platform_device *pd) { unsigned int result; - sc_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL); + sc_handle = kzalloc_obj(struct device_attribute, GFP_KERNEL); if (!sc_handle) return -ENOMEM; @@ -2999,7 +2999,7 @@ static int sony_nc_touchpad_setup(struct platform_device *pd, { int ret = 0; - tp_ctl = kzalloc(sizeof(struct touchpad_control), GFP_KERNEL); + tp_ctl = kzalloc_obj(struct touchpad_control, GFP_KERNEL); if (!tp_ctl) return -ENOMEM; @@ -4161,7 +4161,8 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context) case ACPI_RESOURCE_TYPE_START_DEPENDENT: { /* start IO enumeration */ - struct sony_pic_ioport *ioport = kzalloc(sizeof(*ioport), GFP_KERNEL); + struct sony_pic_ioport *ioport = kzalloc_obj(*ioport, + GFP_KERNEL); if (!ioport) return AE_ERROR; @@ -4191,8 +4192,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context) p->interrupts[i]); continue; } - interrupt = kzalloc(sizeof(*interrupt), - GFP_KERNEL); + interrupt = kzalloc_obj(*interrupt, GFP_KERNEL); if (!interrupt) return AE_ERROR; diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c index 53fc2b364552..955021a0ffa4 100644 --- a/drivers/platform/x86/topstar-laptop.c +++ b/drivers/platform/x86/topstar-laptop.c @@ -292,7 +292,7 @@ static int topstar_acpi_add(struct acpi_device *device) dmi_check_system(topstar_dmi_ids); - topstar = kzalloc(sizeof(struct topstar_laptop), GFP_KERNEL); + topstar = kzalloc_obj(struct topstar_laptop, GFP_KERNEL); if (!topstar) return -ENOMEM; diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 5ad3a7183d33..8e1773f44f64 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -3321,7 +3321,7 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) return -ENODEV; } - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; dev->acpi_dev = acpi_dev; diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c index dad2c3e55904..6e71de0abca2 100644 --- a/drivers/platform/x86/toshiba_bluetooth.c +++ b/drivers/platform/x86/toshiba_bluetooth.c @@ -242,7 +242,7 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device) pr_info("Toshiba ACPI Bluetooth device driver\n"); - bt_dev = kzalloc(sizeof(*bt_dev), GFP_KERNEL); + bt_dev = kzalloc_obj(*bt_dev, GFP_KERNEL); if (!bt_dev) return -ENOMEM; bt_dev->acpi_dev = device; diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c index 3c9af441d133..bad9c030295f 100644 --- a/drivers/platform/x86/uniwill/uniwill-acpi.c +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c @@ -1293,7 +1293,7 @@ static int uniwill_add_battery(struct power_supply *battery, struct acpi_battery struct uniwill_battery_entry *entry; int ret; - entry = kzalloc(sizeof(*entry), GFP_KERNEL); + entry = kzalloc_obj(*entry, GFP_KERNEL); if (!entry) return -ENOMEM; diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c index f6a0627f36db..fa2e31151923 100644 --- a/drivers/platform/x86/uv_sysfs.c +++ b/drivers/platform/x86/uv_sysfs.c @@ -216,7 +216,7 @@ static int uv_hubs_init(void) u64 sz; int i, ret; - prev_obj_to_cnode = kmalloc_array(uv_bios_obj_cnt, sizeof(*prev_obj_to_cnode), + prev_obj_to_cnode = kmalloc_objs(*prev_obj_to_cnode, uv_bios_obj_cnt, GFP_KERNEL); if (!prev_obj_to_cnode) return -ENOMEM; @@ -242,14 +242,14 @@ static int uv_hubs_init(void) goto err_enum_objs; } - uv_hubs = kcalloc(uv_bios_obj_cnt, sizeof(*uv_hubs), GFP_KERNEL); + uv_hubs = kzalloc_objs(*uv_hubs, uv_bios_obj_cnt, GFP_KERNEL); if (!uv_hubs) { ret = -ENOMEM; goto err_enum_objs; } for (i = 0; i < uv_bios_obj_cnt; i++) { - uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL); + uv_hubs[i] = kzalloc_obj(*uv_hubs[i], GFP_KERNEL); if (!uv_hubs[i]) { i--; ret = -ENOMEM; @@ -368,7 +368,7 @@ static int uv_ports_init(void) s64 biosr; int j = 0, k = 0, ret, sz; - port_buf = kcalloc(uv_bios_obj_cnt, sizeof(*port_buf), GFP_KERNEL); + port_buf = kzalloc_objs(*port_buf, uv_bios_obj_cnt, GFP_KERNEL); if (!port_buf) return -ENOMEM; @@ -388,8 +388,8 @@ static int uv_ports_init(void) } } for (j = 0; j < uv_bios_obj_cnt; j++) { - uv_hubs[j]->ports = kcalloc(hub_buf[j].ports, - sizeof(*uv_hubs[j]->ports), GFP_KERNEL); + uv_hubs[j]->ports = kzalloc_objs(*uv_hubs[j]->ports, + hub_buf[j].ports, GFP_KERNEL); if (!uv_hubs[j]->ports) { ret = -ENOMEM; j--; @@ -398,7 +398,8 @@ static int uv_ports_init(void) } for (j = 0; j < uv_bios_obj_cnt; j++) { for (k = 0; k < hub_buf[j].ports; k++) { - uv_hubs[j]->ports[k] = kzalloc(sizeof(*uv_hubs[j]->ports[k]), GFP_KERNEL); + uv_hubs[j]->ports[k] = kzalloc_obj(*uv_hubs[j]->ports[k], + GFP_KERNEL); if (!uv_hubs[j]->ports[k]) { ret = -ENOMEM; k--; @@ -674,8 +675,8 @@ static int pci_topology_init(void) } num_pci_lines = l; - uv_pci_objs = kcalloc(num_pci_lines, - sizeof(*uv_pci_objs), GFP_KERNEL); + uv_pci_objs = kzalloc_objs(*uv_pci_objs, num_pci_lines, + GFP_KERNEL); if (!uv_pci_objs) { kfree(pci_top_str); ret = -ENOMEM; @@ -683,7 +684,8 @@ static int pci_topology_init(void) } start = pci_top_str; while ((found = strsep(&start, "\n")) != NULL) { - uv_pci_objs[k] = kzalloc(sizeof(*uv_pci_objs[k]), GFP_KERNEL); + uv_pci_objs[k] = kzalloc_obj(*uv_pci_objs[k], + GFP_KERNEL); if (!uv_pci_objs[k]) { ret = -ENOMEM; goto err_pci_obj; diff --git a/drivers/platform/x86/wireless-hotkey.c b/drivers/platform/x86/wireless-hotkey.c index a220fe4f9ef8..bba55c634e2c 100644 --- a/drivers/platform/x86/wireless-hotkey.c +++ b/drivers/platform/x86/wireless-hotkey.c @@ -91,7 +91,7 @@ static int wl_add(struct acpi_device *device) struct wl_button *button; int err; - button = kzalloc(sizeof(struct wl_button), GFP_KERNEL); + button = kzalloc_obj(struct wl_button, GFP_KERNEL); if (!button) return -ENOMEM; diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c index 6588fae30356..15a50ced6867 100644 --- a/drivers/platform/x86/x86-android-tablets/core.c +++ b/drivers/platform/x86/x86-android-tablets/core.c @@ -49,7 +49,7 @@ int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id, struct gpiod_lookup_table *lookup; struct gpio_desc *gpiod; - lookup = kzalloc(struct_size(lookup, table, 2), GFP_KERNEL); + lookup = kzalloc_flex(*lookup, table, 2, GFP_KERNEL); if (!lookup) return -ENOMEM; @@ -447,7 +447,8 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev) exit_handler = dev_info->exit; } - i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL); + i2c_clients = kzalloc_objs(*i2c_clients, dev_info->i2c_client_count, + GFP_KERNEL); if (!i2c_clients) { x86_android_tablet_remove(pdev); return -ENOMEM; @@ -462,7 +463,7 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev) } } - spi_devs = kcalloc(dev_info->spi_dev_count, sizeof(*spi_devs), GFP_KERNEL); + spi_devs = kzalloc_objs(*spi_devs, dev_info->spi_dev_count, GFP_KERNEL); if (!spi_devs) { x86_android_tablet_remove(pdev); return -ENOMEM; @@ -478,7 +479,7 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev) } /* + 1 to make space for the (optional) gpio_keys_button platform device */ - pdevs = kcalloc(dev_info->pdev_count + 1, sizeof(*pdevs), GFP_KERNEL); + pdevs = kzalloc_objs(*pdevs, dev_info->pdev_count + 1, GFP_KERNEL); if (!pdevs) { x86_android_tablet_remove(pdev); return -ENOMEM; @@ -494,7 +495,7 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev) } } - serdevs = kcalloc(dev_info->serdev_count, sizeof(*serdevs), GFP_KERNEL); + serdevs = kzalloc_objs(*serdevs, dev_info->serdev_count, GFP_KERNEL); if (!serdevs) { x86_android_tablet_remove(pdev); return -ENOMEM; diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c index cb02222c978c..6bc5cd2abfab 100644 --- a/drivers/platform/x86/xo15-ebook.c +++ b/drivers/platform/x86/xo15-ebook.c @@ -86,7 +86,7 @@ static int ebook_switch_add(struct acpi_device *device) struct input_dev *input; int error; - button = kzalloc(sizeof(struct ebook_switch), GFP_KERNEL); + button = kzalloc_obj(struct ebook_switch, GFP_KERNEL); if (!button) return -ENOMEM; |
