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

Commit 3cd974e4 authored by Deepak Katragadda's avatar Deepak Katragadda Committed by David Collins
Browse files

clk: qcom: clk-aop-qmp: Fix issue with registering the clock provider



While registering the QDSS clock provider with the framework,
pass in the clk data array with references to both the QDSS
clocks. In its current implementation, the QDSS clock driver
only adds the clk_get callback for one of the clocks which
leads to clients getting the clock handle to it when they
try to reference either of the clocks.

Change-Id: I41fc4c1ea57ad0f59a1af126b6025c21af72cbe2
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent cf3aa8bd
Loading
Loading
Loading
Loading
+15 −1
Original line number Original line Diff line number Diff line
@@ -256,6 +256,7 @@ static int aop_qmp_clk_probe(struct platform_device *pdev)
	struct clk *clk = NULL;
	struct clk *clk = NULL;
	struct device_node *np = pdev->dev.of_node;
	struct device_node *np = pdev->dev.of_node;
	struct mbox_chan *mbox = NULL;
	struct mbox_chan *mbox = NULL;
	struct clk_onecell_data *clk_data;
	int num_clks = ARRAY_SIZE(aop_qmp_clk_hws);
	int num_clks = ARRAY_SIZE(aop_qmp_clk_hws);
	int ret = 0, i = 0;
	int ret = 0, i = 0;


@@ -267,6 +268,17 @@ static int aop_qmp_clk_probe(struct platform_device *pdev)
	if (ret < 0)
	if (ret < 0)
		return ret;
		return ret;


	clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL);
	if (!clk_data)
		return -ENOMEM;

	clk_data->clks = devm_kcalloc(&pdev->dev, num_clks,
					sizeof(*clk_data->clks), GFP_KERNEL);
	if (!clk_data->clks)
		return -ENOMEM;

	clk_data->clk_num = num_clks;

	for (i = 1; i < num_clks; i++) {
	for (i = 1; i < num_clks; i++) {
		if (!aop_qmp_clk_hws[i])
		if (!aop_qmp_clk_hws[i])
			continue;
			continue;
@@ -289,14 +301,16 @@ static int aop_qmp_clk_probe(struct platform_device *pdev)
	for (i = 0; i < num_clks; i++) {
	for (i = 0; i < num_clks; i++) {
		if (!aop_qmp_clk_hws[i])
		if (!aop_qmp_clk_hws[i])
			continue;
			continue;

		clk = devm_clk_register(&pdev->dev, aop_qmp_clk_hws[i]);
		clk = devm_clk_register(&pdev->dev, aop_qmp_clk_hws[i]);
		if (IS_ERR(clk)) {
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			ret = PTR_ERR(clk);
			goto fail;
			goto fail;
		}
		}
		clk_data->clks[i] = clk;
	}
	}


	ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
	ret = of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
	if (ret) {
	if (ret) {
		dev_err(&pdev->dev, "Failed to register clock provider\n");
		dev_err(&pdev->dev, "Failed to register clock provider\n");
		goto fail;
		goto fail;