Re: [PATCH 2/4] cxl/mem: Fix cdev_device_add() error handling

2021-03-29 Thread Dan Williams
On Mon, Mar 29, 2021 at 3:44 PM Jason Gunthorpe wrote: > > On Mon, Mar 29, 2021 at 02:03:37PM -0700, Dan Williams wrote: > > > Ugh, exactly why I was motivated to attempt to preclude this with new > > core infrastructure that attempted to fix this centrally [1]. Remove > > the possibility of "oth

Re: [PATCH 2/4] cxl/mem: Fix cdev_device_add() error handling

2021-03-29 Thread Jason Gunthorpe
On Mon, Mar 29, 2021 at 02:03:37PM -0700, Dan Williams wrote: > Ugh, exactly why I was motivated to attempt to preclude this with new > core infrastructure that attempted to fix this centrally [1]. Remove > the possibility of "others" getting this wrong. However after my > initial idea bounced of

Re: [PATCH 2/4] cxl/mem: Fix cdev_device_add() error handling

2021-03-29 Thread Dan Williams
On Thu, Mar 25, 2021 at 10:12 AM Jason Gunthorpe wrote: > > On Wed, Mar 24, 2021 at 02:01:56PM -0700, Dan Williams wrote: > > If cdev_device_add() fails then the allocation performed by > > dev_set_name() is leaked. Use put_device(), not open coded release, for > > device_add() failures. > > > > T

Re: [PATCH 2/4] cxl/mem: Fix cdev_device_add() error handling

2021-03-25 Thread Jason Gunthorpe
On Wed, Mar 24, 2021 at 02:01:56PM -0700, Dan Williams wrote: > If cdev_device_add() fails then the allocation performed by > dev_set_name() is leaked. Use put_device(), not open coded release, for > device_add() failures. > > The comment is obsolete because direct err_id failures need not worry >

[PATCH 2/4] cxl/mem: Fix cdev_device_add() error handling

2021-03-24 Thread Dan Williams
If cdev_device_add() fails then the allocation performed by dev_set_name() is leaked. Use put_device(), not open coded release, for device_add() failures. The comment is obsolete because direct err_id failures need not worry about the device being live. The release method expects the percpu_ref i