Skip to contentSkip to conversation

cpufreq: imx-cpufreq-dt: Add "cpu-supply" property check

PATCH Applied Anson Huang 2 participants 2 messages Feb 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: imx-cpufreq-dt: Add "cpu-supply" property check

The cpufreq-dt driver allows cpufreq driver enabled without valid regulator assigned, however, all i.MX platforms using cpufreq-dt driver now require valid regulator, add "cpu-supply" property check to avoid i.MX platforms' cpufreq enabled without valid regulator and lead to system unstable.

---
 drivers/cpufreq/imx-cpufreq-dt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/cpufreq/imx-cpufreq-dt.c +3 -0
index 6cb8193..0e29d88 100644
@@ -31,6 +31,9 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
 	int speed_grade, mkt_segment;
 	int ret;
 
+	if (!of_find_property(cpu_dev->of_node, "cpu-supply", NULL))
+		return -ENODEV;
+
 	ret = nvmem_cell_read_u32(cpu_dev, "speed_grade", &cell_value);
 	if (ret)
 		return ret;
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 16 lines · Anson Huang

The cpufreq-dt driver allows cpufreq driver enabled without valid regulator assigned, however, all i.MX platforms using cpufreq-dt driver now require valid regulator, add "cpu-supply" property check to avoid i.MX platforms' cpufreq enabled without valid regulator and lead to system unstable.

---
 drivers/cpufreq/imx-cpufreq-dt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/cpufreq/imx-cpufreq-dt.c +0 -0
index 6cb8193..0e29d88 100644

drivers/cpufreq/imx-cpufreq-dt.c static int imx_cpufreq_dt_probe(struct platform_device *pdev) · line 39

Quoted 9 lines
drivers/cpufreq/imx-cpufreq-dt.c +3 -0
@@ -31,6 +31,9 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
 	int speed_grade, mkt_segment;
 	int ret;
 
+	if (!of_find_property(cpu_dev->of_node, "cpu-supply", NULL))
+		return -ENODEV;
+
 	ret = nvmem_cell_read_u32(cpu_dev, "speed_grade", &cell_value);
 	if (ret)
 		return ret;

Applied. Thanks.

Signature · 1 line
viresh