Commit 6b31afce authored by Wei Yongjun's avatar Wei Yongjun Committed by Jason Gunthorpe

RDMA/rtrs: server: Fix some error return code

Fix to return negative error code -ENOMEM from the some error handling
cases instead of 0, as done elsewhere in this function.

Fixes: 9cb83748 ("RDMA/rtrs: server: main functionality")
Fixes: 91b11610 ("RDMA/rtrs: server: sysfs interface functions")
Link: https://lore.kernel.org/r/20200519091912.134358-1-weiyongjun1@huawei.comReported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarDanil Kipnis <danil.kipnis@cloud.ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent e1984086
...@@ -189,6 +189,7 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) ...@@ -189,6 +189,7 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
} }
srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj); srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj);
if (!srv->kobj_paths) { if (!srv->kobj_paths) {
err = -ENOMEM;
pr_err("kobject_create_and_add(): %d\n", err); pr_err("kobject_create_and_add(): %d\n", err);
device_unregister(&srv->dev); device_unregister(&srv->dev);
goto unlock; goto unlock;
......
...@@ -660,8 +660,8 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) ...@@ -660,8 +660,8 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess)
GFP_KERNEL, sess->s.dev->ib_dev, GFP_KERNEL, sess->s.dev->ib_dev,
DMA_TO_DEVICE, rtrs_srv_rdma_done); DMA_TO_DEVICE, rtrs_srv_rdma_done);
if (!srv_mr->iu) { if (!srv_mr->iu) {
rtrs_err(ss, "rtrs_iu_alloc(), err: %d\n", err = -ENOMEM;
-ENOMEM); rtrs_err(ss, "rtrs_iu_alloc(), err: %d\n", err);
goto free_iu; goto free_iu;
} }
} }
...@@ -2150,8 +2150,10 @@ static int __init rtrs_server_init(void) ...@@ -2150,8 +2150,10 @@ static int __init rtrs_server_init(void)
goto out_chunk_pool; goto out_chunk_pool;
} }
rtrs_wq = alloc_workqueue("rtrs_server_wq", WQ_MEM_RECLAIM, 0); rtrs_wq = alloc_workqueue("rtrs_server_wq", WQ_MEM_RECLAIM, 0);
if (!rtrs_wq) if (!rtrs_wq) {
err = -ENOMEM;
goto out_dev_class; goto out_dev_class;
}
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment