Re: [PATCH V3 6/6] cpufreq: Loongson1: Add cpufreq driver for Loongson1B

From: Viresh Kumar
Date: Fri Oct 17 2014 - 06:37:56 EST


On 17 October 2014 15:53, Kelvin Cheung <keguang.zhang@xxxxxxxxx> wrote:
> This patch adds cpufreq driver for Loongson1B which
> is capable of changing the CPU frequency dynamically.
>
> Signed-off-by: Kelvin Cheung <keguang.zhang@xxxxxxxxx>
>
> ---
> V3:
> Remove superfluous devm_clk_put().

Sorry for being bad to you :)

> +static int ls1x_cpufreq_probe(struct platform_device *pdev)
> +{
> + struct plat_ls1x_cpufreq *pdata = pdev->dev.platform_data;
> + struct clk *clk;
> + int ret;
> +
> + if (!pdata || !pdata->clk_name || !pdata->osc_clk_name)
> + return -EINVAL;
> +
> + ls1x_cpufreq.dev = &pdev->dev;
> +
> + clk = devm_clk_get(&pdev->dev, pdata->clk_name);
> + if (IS_ERR(clk)) {
> + dev_err(ls1x_cpufreq.dev, "unable to get %s clock\n",
> + pdata->clk_name);
> + ret = PTR_ERR(clk);
> + goto out;
> + }
> + ls1x_cpufreq.clk = clk;
> +
> + clk = clk_get_parent(clk);
> + if (IS_ERR(clk)) {
> + dev_err(ls1x_cpufreq.dev, "unable to get parent of %s clock\n",
> + __clk_get_name(ls1x_cpufreq.clk));
> + ret = PTR_ERR(clk);
> + goto out;
> + }
> + ls1x_cpufreq.mux_clk = clk;
> +
> + clk = clk_get_parent(clk);
> + if (IS_ERR(clk)) {
> + dev_err(ls1x_cpufreq.dev, "unable to get parent of %s clock\n",
> + __clk_get_name(ls1x_cpufreq.mux_clk));
> + ret = PTR_ERR(clk);
> + goto out;
> + }
> + ls1x_cpufreq.pll_clk = clk;
> +
> + clk = devm_clk_get(&pdev->dev, pdata->osc_clk_name);
> + if (IS_ERR(clk)) {
> + dev_err(ls1x_cpufreq.dev, "unable to get %s clock\n",
> + pdata->osc_clk_name);
> + ret = PTR_ERR(clk);
> + goto out;
> + }
> + ls1x_cpufreq.osc_clk = clk;
> +
> + ls1x_cpufreq.max_freq = pdata->max_freq;
> + ls1x_cpufreq.min_freq = pdata->min_freq;
> +
> + ret = cpufreq_register_driver(&ls1x_cpufreq_driver);
> + if (ret) {
> + dev_err(ls1x_cpufreq.dev,
> + "failed to register cpufreq driver: %d\n", ret);
> + goto out;
> + }
> +
> + ret = cpufreq_register_notifier(&ls1x_cpufreq_notifier_block,
> + CPUFREQ_TRANSITION_NOTIFIER);
> +
> + if (!ret)
> + goto out;
> +
> + dev_err(ls1x_cpufreq.dev, "failed to register cpufreq notifier: %d\n",
> + ret);
> +
> + cpufreq_unregister_driver(&ls1x_cpufreq_driver);
> +out:

But all these goto out; doesn't make sense anymore. Just issue returns
from all places and add

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/