From: Hariprasad Kelam Date: Sun, 21 Jul 2019 18:08:15 +0000 (+0530) Subject: cpufreq: ap806: Add NULL check after kcalloc X-Git-Tag: v5.15~5517^2~2^2^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3355c91b79394593ebbb197c8e930a91826f4ff3;p=platform%2Fkernel%2Flinux-starfive.git cpufreq: ap806: Add NULL check after kcalloc 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 Signed-off-by: Viresh Kumar --- diff --git a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c index 988ebc3..39e34f50 100644 --- a/drivers/cpufreq/armada-8k-cpufreq.c +++ b/drivers/cpufreq/armada-8k-cpufreq.c @@ -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); /*