From: Rob Jones <rob.jones@codethink.co.uk>
To: dhowells@redhat.com
Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org,
linux-kernel@codethink.co.uk, rob.jones@codethink.co.uk
Subject: [PATCH] fs/fscache/object-list.c: use __seq_open_private()
Date: Wed, 17 Sep 2014 09:56:40 +0100 [thread overview]
Message-ID: <1410944200-24288-1-git-send-email-rob.jones@codethink.co.uk> (raw)
Reduce boilerplate code by using __seq_open_private() instead of seq_open()
in fscache_objlist_open().
Signed-off-by: Rob Jones <rob.jones@codethink.co.uk>
---
Note that sparse generates a warning on this file but it is outside the
remit of this patch.
Note 2, it looks to me like the sparse warning may be a false positive.
fs/fscache/object-list.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index b5ebc2d..a1ca2f9 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -380,26 +380,14 @@ no_config:
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;
}
--
1.7.10.4
next reply other threads:[~2014-09-17 8:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 8:56 Rob Jones [this message]
2014-09-29 15:42 ` [PATCH] fs/fscache/object-list.c: use __seq_open_private() Rob Jones
2014-10-14 8:45 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410944200-24288-1-git-send-email-rob.jones@codethink.co.uk \
--to=rob.jones@codethink.co.uk \
--cc=dhowells@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-kernel@codethink.co.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).