Re: [PATCH] drm/amdgpu/discovery: fix possible memory leak

2022-10-19 Thread Yang Yingliang
Hi, On 2022/10/19 11:37, Luben Tuikov wrote: On 2022-10-18 04:05, Yang Yingliang wrote: If kset_register() fails, the refcount of device is not 0, the name allocated in dev_set_name() is leaked. Fix this by calling kset_put(), so that it will be freed in callback function kobject_cleanup().

Re: [PATCH] drm/amdgpu/discovery: fix possible memory leak

2022-10-18 Thread Luben Tuikov
On 2022-10-18 23:37, Luben Tuikov wrote: > On 2022-10-18 04:05, Yang Yingliang wrote: >> If kset_register() fails, the refcount of device is not 0, the name allocated >> in dev_set_name() is leaked. Fix this by calling kset_put(), so that it will >> be freed in callback function kobject_cleanup().

Re: [PATCH] drm/amdgpu/discovery: fix possible memory leak

2022-10-18 Thread Luben Tuikov
On 2022-10-18 04:05, Yang Yingliang wrote: > If kset_register() fails, the refcount of device is not 0, the name allocated > in dev_set_name() is leaked. Fix this by calling kset_put(), so that it will > be freed in callback function kobject_cleanup(). > Good catch, but looking at the code it