Skip to content

Commit

Permalink
clk: meson: use devm_of_clk_add_hw_provider
Browse files Browse the repository at this point in the history
There is no remove callbacks in meson's clock controllers and
of_clk_del_provider is never called if of_clk_add_hw_provider has been
executed, introducing a potential memory leak.
Fixing this by the using the devm variant.

In reality, the leak would never happen since these controllers are
never unloaded once in use ... still, this is worth cleaning.

Signed-off-by: Jerome Brunet <[email protected]>
Signed-off-by: Neil Armstrong <[email protected]>
  • Loading branch information
jbrun3t authored and superna9999 committed Mar 13, 2018
1 parent 323346d commit 332b32a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions drivers/clk/meson/axg.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ static int axg_clkc_probe(struct platform_device *pdev)
}
}

return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
clkc_data->hw_onecell_data);
return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
clkc_data->hw_onecell_data);
}

static struct platform_driver axg_driver = {
Expand Down
5 changes: 3 additions & 2 deletions drivers/clk/meson/gxbb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2002,8 +2002,9 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
goto iounmap;
}

return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
clkc_data->hw_onecell_data);

return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
clkc_data->hw_onecell_data);

iounmap:
iounmap(clk_base);
Expand Down
4 changes: 2 additions & 2 deletions drivers/clk/meson/meson8b.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,8 @@ static int meson8b_clkc_probe(struct platform_device *pdev)
return ret;
}

return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
&meson8b_hw_onecell_data);
return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
&meson8b_hw_onecell_data);
}

static const struct of_device_id meson8b_clkc_match_table[] = {
Expand Down

0 comments on commit 332b32a

Please sign in to comment.