Thread (58 messages) 58 messages, 4 authors, 2021-03-18
STALE1902d
Revisions (2)
  1. v1 current
  2. v1 [diff vs current]

[PATCH 08/11] PM / devfreq: check get_dev_status in devfreq_update_stats

From: Dong Aisheng <aisheng.dong@nxp.com>
Date: 2021-03-09 13:13:32
Also in: linux-arm-kernel, lkml
Subsystem: device frequency (devfreq), the rest · Maintainers: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Linus Torvalds

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>
---
 drivers/devfreq/governor.h | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h
index 31af6d072a10..67a6dbdd5d23 100644
--- a/drivers/devfreq/governor.h
+++ b/drivers/devfreq/governor.h
@@ -89,6 +89,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 */
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help