clk: mvebu: armada-37xx-tbg: Switch to clk_get and balance it in probe
authorGregory CLEMENT <gregory.clement@bootlin.com>
Wed, 10 Oct 2018 18:18:38 +0000 (20:18 +0200)
committerStephen Boyd <sboyd@kernel.org>
Tue, 16 Oct 2018 23:51:03 +0000 (16:51 -0700)
The parent clock is get only to have its name, and then the clock is no
more used, so we can safely free it using clk_put. Furthermore as between
the successful devm_clk_get() and the devm_clk_put() call we don't exit
the probe function in error so I can use non managed version of clk_get()
and clk_put().

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mvebu/armada-37xx-tbg.c

index 7ff041f..4de15d4 100644 (file)
@@ -99,12 +99,13 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
        hw_tbg_data->num = NUM_TBG;
        platform_set_drvdata(pdev, hw_tbg_data);
 
-       parent = devm_clk_get(dev, NULL);
+       parent = clk_get(dev, NULL);
        if (IS_ERR(parent)) {
                dev_err(dev, "Could get the clock parent\n");
                return -EINVAL;
        }
        parent_name = __clk_get_name(parent);
+       clk_put(parent);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        reg = devm_ioremap_resource(dev, res);