Skip to content

Commit

Permalink
cpufreq: imx6q: fix error handling
Browse files Browse the repository at this point in the history
[ Upstream commit 3646f50 ]

When speed checking failed, direclty jumping to put_node label
is not correct. Need jump to out_free_opp to avoid resources leak.

Fixes: 2733fb0 ("cpufreq: imx6q: read OCOTP through nvmem for imx6ul/imx6ull")
Signed-off-by: Peng Fan <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
MrVan authored and gregkh committed Apr 17, 2020
1 parent c5bcaac commit f6bb3ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/cpufreq/imx6q-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,23 +381,24 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
goto put_reg;
}

/* Because we have added the OPPs here, we must free them */
free_opp = true;

if (of_machine_is_compatible("fsl,imx6ul") ||
of_machine_is_compatible("fsl,imx6ull")) {
ret = imx6ul_opp_check_speed_grading(cpu_dev);
if (ret) {
if (ret == -EPROBE_DEFER)
goto put_node;
goto out_free_opp;

dev_err(cpu_dev, "failed to read ocotp: %d\n",
ret);
goto put_node;
goto out_free_opp;
}
} else {
imx6q_opp_check_speed_grading(cpu_dev);
}

/* Because we have added the OPPs here, we must free them */
free_opp = true;
num = dev_pm_opp_get_opp_count(cpu_dev);
if (num < 0) {
ret = num;
Expand Down

0 comments on commit f6bb3ea

Please sign in to comment.