Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: sfi: use kmemdup rather than duplicating its implementation

The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Andrzej Hajda and committed by
Rafael J. Wysocki
a482e556 36dfef23

+1 -3
+1 -3
drivers/cpufreq/sfi-cpufreq.c
··· 45 45 pentry = (struct sfi_freq_table_entry *)sb->pentry; 46 46 totallen = num_freq_table_entries * sizeof(*pentry); 47 47 48 - sfi_cpufreq_array = kzalloc(totallen, GFP_KERNEL); 48 + sfi_cpufreq_array = kmemdup(pentry, totallen, GFP_KERNEL); 49 49 if (!sfi_cpufreq_array) 50 50 return -ENOMEM; 51 - 52 - memcpy(sfi_cpufreq_array, pentry, totallen); 53 51 54 52 return 0; 55 53 }