diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-06-03 19:09:07 +0200 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2017-06-08 03:02:31 -0700 |
commit | 6b72de4d331f058dbd8fa327f1e5d0a729583f56 (patch) | |
tree | 3bbf45c73ce68fe53b9a3d27c6524a47997e64c5 /arch/arm/mach-omap2/sr_device.c | |
parent | 1dfb5b59d6571104eff6629a0e73a6af347a3226 (diff) | |
download | talos-obmc-linux-6b72de4d331f058dbd8fa327f1e5d0a729583f56.tar.gz talos-obmc-linux-6b72de4d331f058dbd8fa327f1e5d0a729583f56.zip |
ARM: OMAP2+: Use kcalloc() in sr_set_nvalues()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/sr_device.c')
-rw-r--r-- | arch/arm/mach-omap2/sr_device.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index 01df4907c0e3..65775c6e8c27 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c @@ -44,9 +44,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, while (volt_data[count].volt_nominal) count++; - nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count, - GFP_KERNEL); - + nvalue_table = kcalloc(count, sizeof(*nvalue_table), GFP_KERNEL); if (!nvalue_table) { pr_err("OMAP: SmartReflex: cannot allocate memory for n-value table\n"); return; |