On Tue, Aug 11, 2020 at 02:57:22PM +0530, Md Haris Iqbal wrote: > There are error cases when we will call free_srv before device kobject is > initialized; in such cases calling put_device generates the following > warning, > > kobject: '(null)' (000000009f5445ed): is not initialized, yet > kobject_put() is being called. > > It was suggested by Jason to call device_initialize() sooner. > > So call device_initialize() only once when the server is allocated. If we > end up calling put_srv() and subsequently free_srv(), our call to > put_device() would result in deletion of the obj. Call device_add() later > when we actually have a connection. Correspondingly, call device_del() > instead of device_unregister() when srv->dev_ref falls to 0. > > Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") > Signed-off-by: Md Haris Iqbal <haris.iqbal@xxxxxxxxxxxxxxx> > Reviewed-by: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx> > --- > drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 ++++---- > drivers/infiniband/ulp/rtrs/rtrs-srv.c | 1 + > 2 files changed, 5 insertions(+), 4 deletions(-) Applied to for-rc, thanks Jason