Skip to content

Commit 7951918

Browse files
robherringweiny2
authored andcommitted
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: Rob Herring (Arm) <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Ira Weiny <[email protected]>
1 parent 47ac09b commit 7951918

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/nvdimm/of_pmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int of_pmem_region_probe(struct platform_device *pdev)
4747
}
4848
platform_set_drvdata(pdev, priv);
4949

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

drivers/nvmem/layouts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static int nvmem_layout_bus_populate(struct nvmem_device *nvmem,
123123
int ret;
124124

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

0 commit comments

Comments
 (0)