Skip to contentSkip to conversation

thermal: fix error condition for reading st,thermal-flags

PATCH Superseded Gopi Krishna Menon 2 participants 2 messages Mar 25 – Mar 26 Thermal

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: fix error condition for reading st,thermal-flags

of_property_read_u32 returns 0 on success. The current check returns -EINVAL if the property is read successfully.

Fix the check by removing ! from of_property_read_u32

---
Note:
* This patch is part of the GSoC2026 application process for device tree bindings conversions
* https://github.com/LinuxFoundationGSoC/ProjectIdeas/wiki/GSoC-2026-Device-Tree-Bindings
* Changes have only been compile tested

 drivers/thermal/spear_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/spear_thermal.c +1 -1
index 603dadcd3df5..5e3e9c1f32f8 100644
@@ -93,7 +93,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	int ret = 0, val;
 
-	if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
+	if (!np || of_property_read_u32(np, "st,thermal-flags", &val)) {
 		dev_err(&pdev->dev, "Failed: DT Pdata not passed\n");
 		return -EINVAL;
 	}
Signature · 1 line
2.52.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Gopi Krishna Menon

of_property_read_u32 returns 0 on success. The current check returns -EINVAL if the property is read successfully.

Fix the check by removing ! from of_property_read_u32

---
Note:
* This patch is part of the GSoC2026 application process for device tree bindings conversions
* https://github.com/LinuxFoundationGSoC/ProjectIdeas/wiki/GSoC-2026-Device-Tree-Bindings
* Changes have only been compile tested

  drivers/thermal/spear_thermal.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/spear_thermal.c +0 -0
index 603dadcd3df5..5e3e9c1f32f8 100644

drivers/thermal/spear_thermal.c static int spear_thermal_probe(struct platform_device *pdev) · line 99

Quoted 8 lines
drivers/thermal/spear_thermal.c +1 -1
@@ -93,7 +93,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
  	struct device_node *np = pdev->dev.of_node;
  	int ret = 0, val;
 
-	if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
+	if (!np || of_property_read_u32(np, "st,thermal-flags", &val)) {
  		dev_err(&pdev->dev, "Failed: DT Pdata not passed\n");
  		return -EINVAL;
  	}

Good catch. It deserves the fixes tag, please find the commit which introduced that. With adding that fixes info, feel free to add: