clk: meson: use devm_of_clk_add_hw_provider
authorJerome Brunet <jbrunet@baylibre.com>
Mon, 12 Feb 2018 14:58:29 +0000 (15:58 +0100)
committerNeil Armstrong <narmstrong@baylibre.com>
Tue, 13 Mar 2018 09:03:57 +0000 (10:03 +0100)
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 <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
drivers/clk/meson/axg.c
drivers/clk/meson/gxbb.c
drivers/clk/meson/meson8b.c

index 1f48649a7d2a88357a8a9608c647ac815720d93e..e16d53b6be30a9f624dd957b75875fe36f9be397 100644 (file)
@@ -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 = {
index 423abcb8ef88a209a395802188528e7c5d37cbdc..17f44ac751b3361c7a77cf23aa2e7578a2dd8ff9 100644 (file)
@@ -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);
index 3ffea80c1308a68ec8925ef4e5af63017468aaf9..abac079ff77f76e7e8e5e56b6acb769997d02c45 100644 (file)
@@ -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[] = {