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/ia64-acpi-cpufreq.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/ia64-acpi-cpufreq.c')
| -rw-r--r-- | drivers/cpufreq/ia64-acpi-cpufreq.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c index 573c14ea802d..08792dd4d62a 100644 --- a/drivers/cpufreq/ia64-acpi-cpufreq.c +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c | |||
| @@ -274,7 +274,7 @@ acpi_cpufreq_cpu_init ( | |||
| 274 | 274 | ||
| 275 | pr_debug("acpi_cpufreq_cpu_init\n"); | 275 | pr_debug("acpi_cpufreq_cpu_init\n"); |
| 276 | 276 | ||
| 277 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | 277 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 278 | if (!data) | 278 | if (!data) |
| 279 | return (-ENOMEM); | 279 | return (-ENOMEM); |
| 280 | 280 | ||
| @@ -304,7 +304,7 @@ acpi_cpufreq_cpu_init ( | |||
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | /* alloc freq_table */ | 306 | /* alloc freq_table */ |
| 307 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * | 307 | data->freq_table = kmalloc(sizeof(*data->freq_table) * |
| 308 | (data->acpi_data.state_count + 1), | 308 | (data->acpi_data.state_count + 1), |
| 309 | GFP_KERNEL); | 309 | GFP_KERNEL); |
| 310 | if (!data->freq_table) { | 310 | if (!data->freq_table) { |
