MLK-11912 cpufreq: imx: fix dereference null return value issue
authorBai Ping <b51503@freescale.com>
Thu, 26 Nov 2015 10:22:20 +0000 (18:22 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:16 +0000 (14:49 -0500)
After coverity code check, it reports dereference NULL return value
complain, so fix it.

Signed-off-by: Bai Ping <b51503@freescale.com>
drivers/cpufreq/imx6q-cpufreq.c
drivers/cpufreq/imx7-cpufreq.c

index 09d8974..04b9662 100644 (file)
@@ -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;
index 3acd83b..d5c799a 100644 (file)
@@ -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;