summaryrefslogtreecommitdiff
path: root/drivers/acpi/sysfs.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2021-06-16 20:03:34 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-06-17 18:10:11 +0300
commitb272c05984679c855ff2d08c9d54957bdcfd9b3b (patch)
tree90f74c2cc2523a1444ce802a2cf57528550f5c6d /drivers/acpi/sysfs.c
parentd3121e64ad78ba944596d43d23914cf5f0131666 (diff)
downloadlinux-b272c05984679c855ff2d08c9d54957bdcfd9b3b.tar.xz
ACPI: sysfs: Unify pattern of memory allocations
Use the form of foo = kmalloc(sizeof(*foo)) everywhere in order to unify pattern of memory allocations. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r--drivers/acpi/sysfs.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 20588c64cd1b..5edad9131289 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -389,8 +389,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context)
switch (event) {
case ACPI_TABLE_EVENT_INSTALL:
- table_attr =
- kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
+ table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
if (!table_attr)
return AE_NO_MEMORY;
@@ -842,13 +841,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(struct attribute *),
- GFP_KERNEL);
+ all_attrs = kcalloc(num_counters + 1, sizeof(*all_attrs), GFP_KERNEL);
if (all_attrs == NULL)
return;
- all_counters = kcalloc(num_counters, sizeof(struct event_counter),
- GFP_KERNEL);
+ all_counters = kcalloc(num_counters, sizeof(*all_counters), GFP_KERNEL);
if (all_counters == NULL)
goto fail;
@@ -856,8 +853,7 @@ void acpi_irq_stats_init(void)
if (ACPI_FAILURE(status))
goto fail;
- counter_attrs = kcalloc(num_counters, sizeof(struct kobj_attribute),
- GFP_KERNEL);
+ counter_attrs = kcalloc(num_counters, sizeof(*counter_attrs), GFP_KERNEL);
if (counter_attrs == NULL)
goto fail;