summaryrefslogtreecommitdiff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2016-07-28 19:27:35 +0300
committerDoug Ledford <dledford@redhat.com>2016-08-03 05:46:21 +0300
commitea3a0ee52db0c2ec8d1d0ecdd21e650e6e183085 (patch)
tree05fdcce1e468620f2792c7b7ea6f2aff14544ac5 /drivers/infiniband
parentff4ce9bde9b2a88984c3ee359b952e35fe49c474 (diff)
downloadlinux-ea3a0ee52db0c2ec8d1d0ecdd21e650e6e183085.tar.xz
IB/hfi1: Restructure hfi1_file_open
Rearrange the file open call in prep for new changes. Reviewed-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/hfi1/file_ops.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index b80c8d2ac52b..0522bafb190b 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -168,6 +168,7 @@ static inline int is_valid_mmap(u64 token)
static int hfi1_file_open(struct inode *inode, struct file *fp)
{
+ struct hfi1_filedata *fd;
struct hfi1_devdata *dd = container_of(inode->i_cdev,
struct hfi1_devdata,
user_cdev);
@@ -176,10 +177,15 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)
kobject_get(&dd->kobj);
/* The real work is performed later in assign_ctxt() */
- fp->private_data = kzalloc(sizeof(struct hfi1_filedata), GFP_KERNEL);
- if (fp->private_data) /* no cpu affinity by default */
- ((struct hfi1_filedata *)fp->private_data)->rec_cpu_num = -1;
- return fp->private_data ? 0 : -ENOMEM;
+
+ fd = kzalloc(sizeof(*fd), GFP_KERNEL);
+
+ if (fd) /* no cpu affinity by default */
+ fd->rec_cpu_num = -1;
+
+ fp->private_data = fd;
+
+ return fd ? 0 : -ENOMEM;
}
static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,