Skip to content

Commit b272c05

Browse files
andy-shevrafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent d3121e6 commit b272c05

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/acpi/sysfs.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context)
389389

390390
switch (event) {
391391
case ACPI_TABLE_EVENT_INSTALL:
392-
table_attr =
393-
kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
392+
table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
394393
if (!table_attr)
395394
return AE_NO_MEMORY;
396395

@@ -842,22 +841,19 @@ void acpi_irq_stats_init(void)
842841
num_gpes = acpi_current_gpe_count;
843842
num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA;
844843

845-
all_attrs = kcalloc(num_counters + 1, sizeof(struct attribute *),
846-
GFP_KERNEL);
844+
all_attrs = kcalloc(num_counters + 1, sizeof(*all_attrs), GFP_KERNEL);
847845
if (all_attrs == NULL)
848846
return;
849847

850-
all_counters = kcalloc(num_counters, sizeof(struct event_counter),
851-
GFP_KERNEL);
848+
all_counters = kcalloc(num_counters, sizeof(*all_counters), GFP_KERNEL);
852849
if (all_counters == NULL)
853850
goto fail;
854851

855852
status = acpi_install_global_event_handler(acpi_global_event_handler, NULL);
856853
if (ACPI_FAILURE(status))
857854
goto fail;
858855

859-
counter_attrs = kcalloc(num_counters, sizeof(struct kobj_attribute),
860-
GFP_KERNEL);
856+
counter_attrs = kcalloc(num_counters, sizeof(*counter_attrs), GFP_KERNEL);
861857
if (counter_attrs == NULL)
862858
goto fail;
863859

0 commit comments

Comments
 (0)