Skip to content

Commit

Permalink
fs/fscache/object-list.c: use __seq_open_private()
Browse files Browse the repository at this point in the history
Reduce boilerplate code by using __seq_open_private() instead of seq_open()
in fscache_objlist_open().

Signed-off-by: Rob Jones <[email protected]>
Signed-off-by: David Howells <[email protected]>
Acked-by: Steve Dickson <[email protected]>
  • Loading branch information
Rob Jones authored and dhowells committed Oct 13, 2014
1 parent a30efe2 commit d5d9622
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions fs/fscache/object-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,26 +380,14 @@ static void fscache_objlist_config(struct fscache_objlist_data *data)
static int fscache_objlist_open(struct inode *inode, struct file *file)
{
struct fscache_objlist_data *data;
struct seq_file *m;
int ret;

ret = seq_open(file, &fscache_objlist_ops);
if (ret < 0)
return ret;

m = file->private_data;

/* buffer for key extraction */
data = kmalloc(sizeof(struct fscache_objlist_data), GFP_KERNEL);
if (!data) {
seq_release(inode, file);
data = __seq_open_private(file, &fscache_objlist_ops, sizeof(*data));
if (!data)
return -ENOMEM;
}

/* get the configuration key */
fscache_objlist_config(data);

m->private = data;
return 0;
}

Expand Down

0 comments on commit d5d9622

Please sign in to comment.