]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
IB/srpt: Fix ERR_PTR() vs. NULL checking confusion
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 4 Nov 2011 18:27:32 +0000 (21:27 +0300)
committerRoland Dreier <roland@purestorage.com>
Fri, 3 Feb 2012 17:07:00 +0000 (09:07 -0800)
transport_init_session() and target_fabric_configfs_init() don't
return NULL pointers, they only return ERR_PTRs or valid pointers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/ulp/srpt/ib_srpt.c

index 38ef61dbee0a139c001a7027c0b65bfbe39daa5b..c125614ac256923f91f7c5c89fd0fe926dcbc572 100644 (file)
@@ -2595,7 +2595,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
        }
 
        ch->sess = transport_init_session();
-       if (!ch->sess) {
+       if (IS_ERR(ch->sess)) {
                rej->reason = __constant_cpu_to_be32(
                                SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
                pr_debug("Failed to create session\n");
@@ -4009,10 +4009,10 @@ static int __init srpt_init_module(void)
                goto out;
        }
 
-       ret = -ENODEV;
        srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt");
-       if (!srpt_target) {
+       if (IS_ERR(srpt_target)) {
                printk(KERN_ERR "couldn't register\n");
+               ret = PTR_ERR(srpt_target);
                goto out;
        }