[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f00eed31-4baf-4d5c-934d-8223d1ab554d@moroto.mountain>
Date: Tue, 5 Mar 2024 11:50:29 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Shradha Todi <shradha.t@...sung.com>
Cc: linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, mturquette@...libre.com,
sboyd@...nel.org, jingoohan1@...il.com, lpieralisi@...nel.org,
kw@...ux.com, robh@...nel.org, bhelgaas@...gle.com,
krzysztof.kozlowski@...aro.org, alim.akhtar@...sung.com,
linux@...linux.org.uk, m.szyprowski@...sung.com,
manivannan.sadhasivam@...aro.org, pankaj.dubey@...sung.com,
gost.dev@...sung.com
Subject: Re: [PATCH v6 1/2] clk: Provide managed helper to get and enable
bulk clocks
On Tue, Feb 20, 2024 at 02:10:45PM +0530, Shradha Todi wrote:
> +int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
> + struct clk_bulk_data **clks)
> +{
> + struct clk_bulk_devres *devres;
> + int ret;
> +
> + devres = devres_alloc(devm_clk_bulk_release_all_enable,
> + sizeof(*devres), GFP_KERNEL);
> + if (!devres)
> + return -ENOMEM;
> +
> + ret = clk_bulk_get_all(dev, &devres->clks);
> + if (ret > 0) {
I feel like this should be >= instead of >. There aren't any callers
of this function yet so we can't see what's in *clks at the start but
it's easy to imagine a situation where it's bad data.
> + *clks = devres->clks;
> + devres->num_clks = ret;
> + } else {
> + devres_free(devres);
> + return ret;
When clk_bulk_get_all() returns zero then we return success here.
regards,
dan carpenter
> + }
> +
> + ret = clk_bulk_prepare_enable(devres->num_clks, *clks);
> + if (!ret) {
> + devres_add(dev, devres);
> + } else {
> + clk_bulk_put_all(devres->num_clks, devres->clks);
> + devres_free(devres);
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all_enable);
> +
Powered by blists - more mailing lists