From: Bai Ping Date: Thu, 26 Nov 2015 10:22:20 +0000 (+0800) Subject: MLK-11912 cpufreq: imx: fix dereference null return value issue X-Git-Tag: C0P2-H0.0--20200415~4020 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=e2068738c729bd99ccd96bcb8a86e4ebddf292c4;p=linux.git MLK-11912 cpufreq: imx: fix dereference null return value issue After coverity code check, it reports dereference NULL return value complain, so fix it. Signed-off-by: Bai Ping --- diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 09d897419fb6..04b9662e7f9e 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -229,6 +229,9 @@ static int imx6_cpufreq_pm_notify(struct notifier_block *nb, * devices may be already suspended, to avoid such scenario, * we just increase cpufreq to highest setpoint before suspend. */ + if (!data) + return NOTIFY_BAD; + switch (event) { case PM_SUSPEND_PREPARE: cpufreq_policy_min_pre_suspend = data->user_policy.min; diff --git a/drivers/cpufreq/imx7-cpufreq.c b/drivers/cpufreq/imx7-cpufreq.c index 3acd83bf7494..d5c799a0c0f9 100644 --- a/drivers/cpufreq/imx7-cpufreq.c +++ b/drivers/cpufreq/imx7-cpufreq.c @@ -135,6 +135,9 @@ static int imx7_cpufreq_pm_notify(struct notifier_block *nb, * devices may be already suspended, to avoid such scenario, * we just increase cpufreq to highest setpoint before suspend. */ + if (!data) + return NOTIFY_BAD; + switch (event) { case PM_SUSPEND_PREPARE: cpufreq_policy_min_pre_suspend = data->user_policy.min;