Skip to contentSkip to conversation

hwmon: vexpress: Use of_property_present()

PATCH Applied Rob Herring (Arm) 3 participants 3 messages Jul 31, 2024

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

PATCH 1/1 hwmon: vexpress: Use of_property_present()

Use of_property_present() to test for property presence rather than of_get_property(). This is part of a larger effort to remove callers of of_get_property() and similar functions. of_get_property() leaks the DT property data pointer which is a problem for dynamically allocated nodes which may be freed.

---
 drivers/hwmon/vexpress-hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/vexpress-hwmon.c +1 -1
index d82a3b454d0e..a2e350f52a9e 100644
@@ -72,7 +72,7 @@ static umode_t vexpress_hwmon_attr_is_visible(struct kobject *kobj,
 				struct device_attribute, attr);
 
 	if (dev_attr->show == vexpress_hwmon_label_show &&
-			!of_get_property(dev->of_node, "label", NULL))
+			!of_property_present(dev->of_node, "label"))
 		return 0;
 
 	return attr->mode;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Rob Herring (Arm)

Use of_property_present() to test for property presence rather than of_get_property(). This is part of a larger effort to remove callers of of_get_property() and similar functions. of_get_property() leaks the DT property data pointer which is a problem for dynamically allocated nodes which may be freed.

Guenter,

I assume you will pick this up.

Signature · 2 lines
Regards,
Sudeep
maintainer Applied
#2 lore raw
In reply to Rob Herring (Arm)
Quoted 8 lines · Rob Herring (Arm)

Use of_property_present() to test for property presence rather than of_get_property(). This is part of a larger effort to remove callers of of_get_property() and similar functions. of_get_property() leaks the DT property data pointer which is a problem for dynamically allocated nodes which may be freed.

Applied.

Thanks,
Guenter