Skip to content

Commit 5fecb93

Browse files
MarileneGarciagregkh
authored andcommitted
nvmem: meson-efuse: Replacing the use of of_node_put to __free
Use __free for device_node values, and thus drop calls to of_node_put. The goal is to reduce memory management issues by using this scope-based of_node_put() cleanup to simplify function exit handling. When using __free a resource is allocated within a block, it is automatically freed at the end of the block. Suggested-by: Julia Lawall <[email protected]> Signed-off-by: MarileneGarcia <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e499d4b commit 5fecb93

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/nvmem/meson-efuse.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,19 @@ static int meson_efuse_probe(struct platform_device *pdev)
4242
{
4343
struct device *dev = &pdev->dev;
4444
struct meson_sm_firmware *fw;
45-
struct device_node *sm_np;
4645
struct nvmem_device *nvmem;
4746
struct nvmem_config *econfig;
4847
struct clk *clk;
4948
unsigned int size;
49+
struct device_node *sm_np __free(device_node) =
50+
of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0);
5051

51-
sm_np = of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0);
5252
if (!sm_np) {
5353
dev_err(&pdev->dev, "no secure-monitor node\n");
5454
return -ENODEV;
5555
}
5656

5757
fw = meson_sm_get(sm_np);
58-
of_node_put(sm_np);
5958
if (!fw)
6059
return -EPROBE_DEFER;
6160

0 commit comments

Comments
 (0)