提交 3af33637 编写于 作者: D Dan Carpenter 提交者: Roland Dreier

IB/srpt: Fix ERR_PTR() vs. NULL checking confusion

transport_init_session() and target_fabric_configfs_init() don't
return NULL pointers, they only return ERR_PTRs or valid pointers.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 ebfded8c
...@@ -2595,7 +2595,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2595,7 +2595,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
} }
ch->sess = transport_init_session(); ch->sess = transport_init_session();
if (!ch->sess) { if (IS_ERR(ch->sess)) {
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
pr_debug("Failed to create session\n"); pr_debug("Failed to create session\n");
...@@ -4009,10 +4009,10 @@ static int __init srpt_init_module(void) ...@@ -4009,10 +4009,10 @@ static int __init srpt_init_module(void)
goto out; goto out;
} }
ret = -ENODEV;
srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt");
if (!srpt_target) { if (IS_ERR(srpt_target)) {
printk(KERN_ERR "couldn't register\n"); printk(KERN_ERR "couldn't register\n");
ret = PTR_ERR(srpt_target);
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册