diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-08-06 13:23:06 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-08-07 17:34:10 -0400 |
commit | d5b73cd870e2b049ef566aec2791dbf5fd26a7ec (patch) | |
tree | 191f399b9ce03fd7a1b6820126823a0d3776e030 /drivers/cpufreq/e_powersaver.c | |
parent | 3a3e9e06d0c11b8efa95933a88c9e67209fa4330 (diff) |
cpufreq: Use sizeof(*ptr) convetion for computing sizes
Chapter 14 of Documentation/CodingStyle says:
The preferred form for passing a size of a struct is the following:
p = kmalloc(sizeof(*p), ...);
The alternative form where struct name is spelled out hurts
readability and introduces an opportunity for a bug when the pointer
variable type is changed but the corresponding sizeof that is passed
to a memory allocator is not.
This wasn't followed consistently in drivers/cpufreq, let's make it
more consistent by always following this rule.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/e_powersaver.c')
-rw-r--r-- | drivers/cpufreq/e_powersaver.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index a60efaeb4cf8..de974be6b773 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c | |||
@@ -54,7 +54,7 @@ static struct acpi_processor_performance *eps_acpi_cpu_perf; | |||
54 | /* Minimum necessary to get acpi_processor_get_bios_limit() working */ | 54 | /* Minimum necessary to get acpi_processor_get_bios_limit() working */ |
55 | static int eps_acpi_init(void) | 55 | static int eps_acpi_init(void) |
56 | { | 56 | { |
57 | eps_acpi_cpu_perf = kzalloc(sizeof(struct acpi_processor_performance), | 57 | eps_acpi_cpu_perf = kzalloc(sizeof(*eps_acpi_cpu_perf), |
58 | GFP_KERNEL); | 58 | GFP_KERNEL); |
59 | if (!eps_acpi_cpu_perf) | 59 | if (!eps_acpi_cpu_perf) |
60 | return -ENOMEM; | 60 | return -ENOMEM; |
@@ -366,7 +366,7 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
366 | states = 2; | 366 | states = 2; |
367 | 367 | ||
368 | /* Allocate private data and frequency table for current cpu */ | 368 | /* Allocate private data and frequency table for current cpu */ |
369 | centaur = kzalloc(sizeof(struct eps_cpu_data) | 369 | centaur = kzalloc(sizeof(*centaur) |
370 | + (states + 1) * sizeof(struct cpufreq_frequency_table), | 370 | + (states + 1) * sizeof(struct cpufreq_frequency_table), |
371 | GFP_KERNEL); | 371 | GFP_KERNEL); |
372 | if (!centaur) | 372 | if (!centaur) |