[PATCH v3 1/4] clk: Provide devm_clk_bulk_get_all_enabled() helper
Stephen Boyd
sboyd at kernel.org
Fri Oct 18 22:56:28 PDT 2024
Quoting Cristian Ciocaltea (2024-10-17 16:17:29)
> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
> index 82ae1f26e634572b943d18b8d86267f0a69911a6..0d0fe364b66a8590d5e7c63dc6c1e70c59d53e89 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -230,25 +239,27 @@ int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
> return -ENOMEM;
>
> ret = clk_bulk_get_all(dev, &devres->clks);
> - if (ret > 0) {
> - *clks = devres->clks;
> - devres->num_clks = ret;
> - } else {
> - devres_free(devres);
> - return ret;
> - }
> + if (ret <= 0)
> + goto err_free_devres;
Please don't use goto so that the diff is minimized.
> +
> + *clks = devres->clks;
> + devres->num_clks = ret;
>
> ret = clk_bulk_prepare_enable(devres->num_clks, *clks);
> - if (!ret) {
> - devres_add(dev, devres);
> - } else {
> + if (ret) {
> clk_bulk_put_all(devres->num_clks, devres->clks);
> - devres_free(devres);
> + goto err_free_devres;
return ret;
More information about the Linux-mediatek
mailing list