Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[linux-2.6-block.git] / drivers / infiniband / hw / hfi1 / file_ops.c
index bd6f03cc5ee0515e99da74f94d305f5179ff0dbe..d9a0f2590294b8fedf487aff586c08047b113135 100644 (file)
@@ -196,9 +196,6 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)
        if (!atomic_inc_not_zero(&dd->user_refcount))
                return -ENXIO;
 
-       /* Just take a ref now. Not all opens result in a context assign */
-       kobject_get(&dd->kobj);
-
        /* The real work is performed later in assign_ctxt() */
 
        fd = kzalloc(sizeof(*fd), GFP_KERNEL);
@@ -208,6 +205,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)
                fd->mm = current->mm;
                mmgrab(fd->mm);
                fd->dd = dd;
+               kobject_get(&fd->dd->kobj);
                fp->private_data = fd;
        } else {
                fp->private_data = NULL;