Re: [RFC PATCH v1 12/38] coco: host: arm64: CCA host platform device driver

Jason Gunthorpe
2025-07-31T12:26:18Z

On Wed, Jul 30, 2025 at 11:28:04AM +0100, Jonathan Cameron wrote:
> > devm is useful to solve complex things, these trivial things should be
> > done normally..
>
> Sure, that would be fine for now. If we end up with a large complex flow that
> happens to have a tsm_register() in amongst various managed resources
> we can revisit. If they all end up looking like this then a manual call
> in remove is fine.

IMHO just don't use devm, it is so easy to use devm wrong and get out
of order clean up. It works well for extremely simple case where 100%
of cleanup is in devm (but then it is questionable if the overhead is
worthwehile), and it is necessary for extremely hard cases where
writing a manual unwind is too hard. But the middle ground it tends to
just make ordering bugs and not provide alot of value, IMHO.

Jason