summaryrefslogtreecommitdiffstats
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2021-03-09 13:58:38 +0100
committerChanwoo Choi <cw00.choi@samsung.com>2021-04-08 06:14:51 +0200
commitb19e13463a1054b1b51f4314a1a53da02aed776f (patch)
treee5b142d14f0e40ee05e3f864a02bb3158cac3b47 /drivers/devfreq
parentPM / devfreq: Fix the wrong set_freq path for userspace governor in Kconfig (diff)
downloadlinux-b19e13463a1054b1b51f4314a1a53da02aed776f.tar.xz
linux-b19e13463a1054b1b51f4314a1a53da02aed776f.zip
PM / devfreq: Check get_dev_status in devfreq_update_stats
Check .get_dev_status() in devfreq_update_stats in case it's abused when a device does not provide it. Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/governor.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h
index 70f44b3ca42e..244634465170 100644
--- a/drivers/devfreq/governor.h
+++ b/drivers/devfreq/governor.h
@@ -91,6 +91,9 @@ int devfreq_update_target(struct devfreq *devfreq, unsigned long freq);
static inline int devfreq_update_stats(struct devfreq *df)
{
+ if (!df->profile->get_dev_status)
+ return -EINVAL;
+
return df->profile->get_dev_status(df->dev.parent, &df->last_status);
}
#endif /* _GOVERNOR_H */