cpufreq: ap806: Add NULL check after kcalloc
authorHariprasad Kelam <hariprasad.kelam@gmail.com>
Sun, 21 Jul 2019 18:08:15 +0000 (23:38 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 22 Jul 2019 05:42:15 +0000 (11:12 +0530)
Add NULL check  after kcalloc.

Fix below issue reported by coccicheck
./drivers/cpufreq/armada-8k-cpufreq.c:138:1-12: alloc with no test,
possible model on line 151

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/armada-8k-cpufreq.c

index 988ebc3..39e34f5 100644 (file)
@@ -136,6 +136,8 @@ static int __init armada_8k_cpufreq_init(void)
 
        nb_cpus = num_possible_cpus();
        freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);
+       if (!freq_tables)
+               return -ENOMEM;
        cpumask_copy(&cpus, cpu_possible_mask);
 
        /*