Skip to content

Commit a1643ae

Browse files
elfringAngeloGioacchino Del Regno
authored andcommitted
soc: mediatek: mtk-svs: Call of_node_put(np) only once in svs_get_subsys_device()
An of_node_put(np) call was immediately used after a pointer check for a of_find_device_by_node() call in this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
1 parent d0fa55c commit a1643ae

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/soc/mediatek/mtk-svs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,14 +2133,12 @@ static struct device *svs_get_subsys_device(struct svs_platform *svsp,
21332133
}
21342134

21352135
pdev = of_find_device_by_node(np);
2136+
of_node_put(np);
21362137
if (!pdev) {
2137-
of_node_put(np);
21382138
dev_err(svsp->dev, "cannot find pdev by %s\n", node_name);
21392139
return ERR_PTR(-ENXIO);
21402140
}
21412141

2142-
of_node_put(np);
2143-
21442142
return &pdev->dev;
21452143
}
21462144

0 commit comments

Comments
 (0)