Re: [PATCH v5] dmaengine: idxd: Do not use devm for 'struct device' object allocation

Jason Gunthorpe
2021-03-24T16:53:29Z

On Wed, Mar 24, 2021 at 09:13:35AM -0700, Dan Williams wrote:

> Which is just:
>
> device_initialize()
> dev_set_name()
>
> ...then the name is set as early as the device is ready to filled in
> with other details. Just checking for dev_set_name() failures does not
> move the api forward in my opinion.

This doesn't work either as the release function must be set after
initialize but before dev_set_name(), otherwise we both can't and must
call put_device() after something like this fails.

I can't see an option other than bite the bullet and fix things.

A static tool to look for these special lifetime rules around the
driver core would be nice.

Jason