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>
This commit is contained in:
parent
5f104f9fc1
commit
b19e13463a
1 changed files with 3 additions and 0 deletions
|
@ -91,6 +91,9 @@ int devfreq_update_target(struct devfreq *devfreq, unsigned long freq);
|
||||||
|
|
||||||
static inline int devfreq_update_stats(struct devfreq *df)
|
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);
|
return df->profile->get_dev_status(df->dev.parent, &df->last_status);
|
||||||
}
|
}
|
||||||
#endif /* _GOVERNOR_H */
|
#endif /* _GOVERNOR_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue