devfreq: update device suspended check

Update device suspended condition check in get_freq function,
in some scenarios the device is in  suspended and if node
is null, the condition will pass and  wrongly code will
proceed to access the node pointer which is null,
update if condition for device suspended state.

Change-Id: Ia18aeaf24c788294beb30d2f9d92d0e85fe90bc6
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
This commit is contained in:
Santosh Mardi 2020-04-13 17:23:01 +05:30 committed by Gerrit - the friendly Code Review server
parent 88aad58420
commit c137a1af19

View file

@ -713,8 +713,11 @@ static int devfreq_bw_hwmon_get_freq(struct devfreq *df,
{
struct hwmon_node *node = df->data;
if (!node)
return -EINVAL;
/* Suspend/resume sequence */
if ((node && !node->mon_started) || df->dev_suspended) {
if (!node->mon_started || df->dev_suspended) {
*freq = node->resume_freq;
*node->dev_ab = node->resume_ab;
return 0;