Skip to content

Commit 1d6aa08

Browse files
windhlbebarino
authored andcommitted
clk: oxnas: Hold reference returned by of_get_parent()
In oxnas_stdclk_probe(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 0bbd72b ("clk: Add Oxford Semiconductor OXNAS Standard Clocks") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20220628143155.170550-1-windhl@126.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 4299733 commit 1d6aa08

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/clk/clk-oxnas.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,17 @@ static const struct of_device_id oxnas_stdclk_dt_ids[] = {
207207

208208
static int oxnas_stdclk_probe(struct platform_device *pdev)
209209
{
210-
struct device_node *np = pdev->dev.of_node;
210+
struct device_node *np = pdev->dev.of_node, *parent_np;
211211
const struct oxnas_stdclk_data *data;
212212
struct regmap *regmap;
213213
int ret;
214214
int i;
215215

216216
data = of_device_get_match_data(&pdev->dev);
217217

218-
regmap = syscon_node_to_regmap(of_get_parent(np));
218+
parent_np = of_get_parent(np);
219+
regmap = syscon_node_to_regmap(parent_np);
220+
of_node_put(parent_np);
219221
if (IS_ERR(regmap)) {
220222
dev_err(&pdev->dev, "failed to have parent regmap\n");
221223
return PTR_ERR(regmap);

0 commit comments

Comments
 (0)