Re: [PATCH v1 1/1] clk: devres: Simplify devres handling functions

From: Andy Shevchenko
Date: Wed Aug 28 2024 - 15:13:40 EST


On Wed, Aug 28, 2024 at 11:39:51AM -0700, Stephen Boyd wrote:
> Quoting Andy Shevchenko (2024-08-28 06:08:20)
> > On Tue, Aug 27, 2024 at 05:19:04PM -0700, Stephen Boyd wrote:
> > > Quoting Andy Shevchenko (2024-08-22 08:58:22)

...

> > > > - state = devres_alloc(devm_clk_release, sizeof(*state), GFP_KERNEL);
> > > > + state = devm_kmalloc(dev, sizeof(*state), GFP_KERNEL);
> > >
> > > When is this allocation freed if the get() fails? When the calling
> > > device driver detaches?
> >
> > At device unbinding. Is it a problem?
>
> It is a change, and the commit text said no functional change :(

Ah, I see. I think it's possible to actually make it happen that there will be
no dangling memory in case of failure. I'll think about that.

--
With Best Regards,
Andy Shevchenko