RDMA/rtrs-srv: Set .release function for rtrs srv device during device init
Subsystems (2)
PATCH v2 1/1 RDMA/rtrs-srv: Set .release function for rtrs srv device during device init
The device .release function was not being set during the device initialization. This was leading to the below warning, in error cases when put_srv was called before device_add was called.
Warning:
Device '(null)' does not have a release() function, it is broken and must be fixed. See Documentation/kobject.txt.
So, set the device .release function during device initialization in the __alloc_srv() function.
---
Change in v2:
Use the complete Fixes line
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 -------- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +0 -8
@@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = { .attrs = rtrs_srv_stats_attrs, }; -static void rtrs_srv_dev_release (struct device *dev) -{ - struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); - -kfree (srv); -} -static int rtrs_srv_create_once_sysfs_root_folders (struct rtrs_srv_sess *sess) {struct rtrs_srv *srv = sess->srv;
@@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) goto unlock; } srv->dev.class = rtrs_dev_class; - srv->dev.release = rtrs_srv_dev_release; err =dev_set_name (&srv->dev,"%s" , sess->s.sessname);if (err) goto unlock;
drivers/infiniband/ulp/rtrs/rtrs-srv.c +8 -0
@@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess)return sess->cur_cq_vector; } +static void rtrs_srv_dev_release (struct device *dev) +{ + struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); + +kfree (srv); +} +static struct rtrs_srv *__alloc_srv (struct rtrs_srv_ctx *ctx,const uuid_t *paths_uuid) {
@@ -1337,6 +1344,7 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, srv->queue_depth = sess_queue_depth; srv->ctx = ctx;device_initialize (&srv->dev); + srv->dev.release = rtrs_srv_dev_release; srv->chunks =kcalloc (srv->queue_depth,sizeof (*srv->chunks),GFP_KERNEL );
Signature · 1 line
2.25.1
Quoted 14 lines · Md Haris Iqbal
The device .release function was not being set during the device initialization. This was leading to the below warning, in error cases when
put_srvwas called beforedevice_addwas called.Warning:
Device '(null)' does not have a
release()function, it is broken and must be fixed. SeeDocumentation/kobject.txt.So, set the device .release function during device initialization in the
__alloc_srv()function.Fixes baa5b28b7a47 ("RDMA/rtrs-srv: Replace device_register with device_initialize and device_add")Signed-off-by Md Haris Iqbal <[email protected]>
Quoted 8 lines
---
Change in v2:
Use the complete Fixes linedrivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 -------- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-)
Thanks,
Quoted 7 lines · Md Haris Iqbal
The device .release function was not being set during the device initialization. This was leading to the below warning, in error cases when
put_srvwas called beforedevice_addwas called.Warning:
Quoted 8 lines
Device '(null)' does not have a
release()function, it is broken and must be fixed. SeeDocumentation/kobject.txt.So, set the device .release function during device initialization in the
__alloc_srv()function.Fixes baa5b28b7a47 ("RDMA/rtrs-srv: Replace device_register with device_initialize and device_add")Signed-off-by Md Haris Iqbal <[email protected]>
Thanks,
Quoted 63 lines
---
Change in v2:
Use the complete Fixes linedrivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 -------- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-)drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +0
-8@@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = { .attrs = rtrs_srv_stats_attrs, }; -static void rtrs_srv_dev_release (struct device *dev) -{ - struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); - -kfree (srv); -} -static int rtrs_srv_create_once_sysfs_root_folders (struct rtrs_srv_sess *sess) {struct rtrs_srv *srv = sess->srv;@@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) goto unlock; } srv->dev.class = rtrs_dev_class; - srv->dev.release = rtrs_srv_dev_release; err =dev_set_name (&srv->dev,"%s" , sess->s.sessname);if (err) goto unlock;drivers/infiniband/ulp/rtrs/rtrs-srv.c +8
-1@@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess)return sess->cur_cq_vector; } +static void rtrs_srv_dev_release (struct device *dev) +{ + struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); + +kfree (srv); +} +static struct rtrs_srv *__alloc_srv (struct rtrs_srv_ctx *ctx,const uuid_t *paths_uuid) {@@ -1337,6 +1344,7 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, srv->queue_depth = sess_queue_depth; srv->ctx = ctx;device_initialize (&srv->dev); + srv->dev.release = rtrs_srv_dev_release; srv->chunks =kcalloc (srv->queue_depth,sizeof (*srv->chunks),GFP_KERNEL ); --2.25.1
Quoted 16 lines · Md Haris Iqbal
The device .release function was not being set during the device initialization. This was leading to the below warning, in error cases when
put_srvwas called beforedevice_addwas called.Warning:
Device '(null)' does not have a
release()function, it is broken and must be fixed. SeeDocumentation/kobject.txt.So, set the device .release function during device initialization in the
__alloc_srv()function.Fixes baa5b28b7a47 ("RDMA/rtrs-srv: Replace device_register with device_initialize and device_add")Signed-off-by Md Haris Iqbal <[email protected]>Reviewed-by Leon Romanovsky <[email protected]>Acked-by Jack Wang <[email protected]>
Quoted 7 lines
---
Change in v2:
Use the complete Fixes linedrivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 8 -------- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-)
Applied to for-rc thanks
Jason