Commit 79519185 authored by Rob Herring (Arm)'s avatar Rob Herring (Arm) Committed by Ira Weiny
Browse files

nvdimm: Use of_property_present() and of_property_read_bool()



Use of_property_present() and of_property_read_bool() to test
property presence and read boolean properties rather than
of_(find|get)_property(). This is part of a larger effort to remove
callers of of_find_property() and similar functions.
of_(find|get)_property() leak the DT struct property and data pointers
which is a problem for dynamically allocated nodes which may be freed.

Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20240731191312.1710417-26-robh@kernel.org


Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
parent 47ac09b9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ static int of_pmem_region_probe(struct platform_device *pdev)
	}
	platform_set_drvdata(pdev, priv);

	is_volatile = !!of_find_property(np, "volatile", NULL);
	is_volatile = of_property_read_bool(np, "volatile");
	dev_dbg(&pdev->dev, "Registering %s regions from %pOF\n",
			is_volatile ? "volatile" : "non-volatile",  np);

+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ static int nvmem_layout_bus_populate(struct nvmem_device *nvmem,
	int ret;

	/* Make sure it has a compatible property */
	if (!of_get_property(layout_dn, "compatible", NULL)) {
	if (!of_property_present(layout_dn, "compatible")) {
		pr_debug("%s() - skipping %pOF, no compatible prop\n",
			 __func__, layout_dn);
		return 0;