Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96f185ac authored by Maxime Ripard's avatar Maxime Ripard
Browse files

clk: sunxi: Make clocks setup functions return their clock



The clocks registration code in clk-sunxi was most of the time not
returning the struct clk (or struct clk array) that was registered,
preventing the users of such functions to manipulate it, for example to
protect it.

Make them return it so that we can start using it.

Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent d221b7a8
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -615,7 +615,7 @@ static const struct mux_data sun8i_h3_ahb2_mux_data __initconst = {
	.shift = 0,
};

static void __init sunxi_mux_clk_setup(struct device_node *node,
static struct clk * __init sunxi_mux_clk_setup(struct device_node *node,
					       struct mux_data *data)
{
	struct clk *clk;
@@ -646,10 +646,12 @@ static void __init sunxi_mux_clk_setup(struct device_node *node,

	of_clk_add_provider(node, of_clk_src_simple_get, clk);
	clk_register_clkdev(clk, clk_name, NULL);
	return;

	return clk;

out_unmap:
	iounmap(reg);
	return NULL;
}


@@ -820,7 +822,7 @@ static const struct divs_data sun6i_a31_pll6_divs_data __initconst = {
 *           |________________________|
 */

static void __init sunxi_divs_clk_setup(struct device_node *node,
static struct clk ** __init sunxi_divs_clk_setup(struct device_node *node,
						 struct divs_data *data)
{
	struct clk_onecell_data *clk_data;
@@ -848,7 +850,7 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,

	clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
	if (!clk_data)
		return;
		return NULL;

	clks = kcalloc(ndivs, sizeof(*clks), GFP_KERNEL);
	if (!clks)
@@ -934,7 +936,7 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,

	of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);

	return;
	return clks;

free_gate:
	kfree(gate);
@@ -942,6 +944,7 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
	kfree(clks);
free_clkdata:
	kfree(clk_data);
	return NULL;
}