RE: [PATCH 1/2] thermal: qoriq: Use devm_add_action_or_reset() to handle all cleanups

From: Anson Huang
Date: Mon Mar 16 2020 - 21:14:51 EST


Hi, Daniel

> Subject: RE: [PATCH 1/2] thermal: qoriq: Use devm_add_action_or_reset() to
> handle all cleanups
>
> Hi, Daniel
>
> > Subject: Re: [PATCH 1/2] thermal: qoriq: Use
> > devm_add_action_or_reset() to handle all cleanups
> >
> > On 12/03/2020 12:47, Anson Huang wrote:
> > > Hi, Daniel
> > >
> > >> Subject: Re: [PATCH 1/2] thermal: qoriq: Use
> > >> devm_add_action_or_reset() to handle all cleanups
> > >>
> > >> On 11/03/2020 06:07, Anson Huang wrote:
> > >>> Use devm_add_action_or_reset() to handle all cleanups of failure
> > >>> in .probe and .remove, then .remove callback can be dropped.
> > >>
> > >> Is this change compatible with the tristate?
> > >
> > > I think so, any concern need me to double confirm?
> >
> > TBH, I discovered the function with your patch. My concern is if the
> > callback is called when unloading the module.
>
> I think so as per my memory, see similar patches as below:
>
>
> commit 19ec11a2233d24a7811836fa735203aaccf95a23
> Author: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
> Date: Thu Jul 11 10:29:35 2019 +0200
>
> gpio: em: remove the gpiochip before removing the irq domain
>
> In commit 8764c4ca5049 ("gpio: em: use the managed version of
> gpiochip_add_data()") we implicitly altered the ordering of resource
> freeing: since gpiochip_remove() calls gpiochip_irqchip_remove()
> internally, we now can potentially use the irq_domain after it was
> destroyed in the remove() callback (as devm resources are freed after
> remove() has returned).
>
> Use devm_add_action_or_reset() to keep the ordering right and entirely
> kill the remove() callback in the driver.
>
>
> commit d9aa5ca429ad30dde96e5966173d18004f16f312
> Author: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
> Date: Fri Apr 19 10:25:01 2019 +0200
>
> rtc: ds2404: simplify .probe and remove .remove
>
> Use devm_add_action_or_reset to simplify .probe and remove .remove
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
>
> drivers/rtc/rtc-ds2404.c

Any further concern?

Thanks,
Anson