Skip to content

Commit

Permalink
clk: s2mps11: Add missing of_node_put and of_clk_del_provider
Browse files Browse the repository at this point in the history
Add of_clk_del_provider to remove previously registered clock provider.
Add of_node_put to decrement the ref count of clock nodes.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
krzk authored and Mike Turquette committed May 23, 2014
1 parent 42dd880 commit bf416bd
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions drivers/clk/clk-s2mps11.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum {

struct s2mps11_clk {
struct sec_pmic_dev *iodev;
struct device_node *clk_np;
struct clk_hw hw;
struct clk *clk;
struct clk_lookup *lookup;
Expand Down Expand Up @@ -156,7 +157,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
{
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
struct device_node *clk_np = NULL;
unsigned int s2mps11_reg;
int i, ret = 0;
u32 val;
Expand All @@ -168,9 +168,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)

s2mps11_clk = s2mps11_clks;

clk_np = s2mps11_clk_parse_dt(pdev);
if (IS_ERR(clk_np))
return PTR_ERR(clk_np);
/* Store clocks of_node in first element of s2mps11_clks array */
s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev);
if (IS_ERR(s2mps11_clks->clk_np))
return PTR_ERR(s2mps11_clks->clk_np);

switch(platform_get_device_id(pdev)->driver_data) {
case S2MPS11X:
Expand Down Expand Up @@ -225,7 +226,8 @@ static int s2mps11_clk_probe(struct platform_device *pdev)

clk_data.clks = clk_table;
clk_data.clk_num = S2MPS11_CLKS_NUM;
of_clk_add_provider(clk_np, of_clk_src_onecell_get, &clk_data);
of_clk_add_provider(s2mps11_clks->clk_np,
of_clk_src_onecell_get, &clk_data);
}

platform_set_drvdata(pdev, s2mps11_clks);
Expand All @@ -250,6 +252,10 @@ static int s2mps11_clk_remove(struct platform_device *pdev)
struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev);
int i;

of_clk_del_provider(s2mps11_clks[0].clk_np);
/* Drop the reference obtained in s2mps11_clk_parse_dt */
of_node_put(s2mps11_clks[0].clk_np);

for (i = 0; i < S2MPS11_CLKS_NUM; i++)
clkdev_drop(s2mps11_clks[i].lookup);

Expand Down

0 comments on commit bf416bd

Please sign in to comment.