Skip to contentSkip to conversation

NFS: silence Sparse warning about a non-ANSI declaration

PATCH In review Dan Carpenter 2 participants 2 messages May 4, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: silence Sparse warning about a non-ANSI declaration

Sparse complains because without the "void", it means that the function takes a variable number of arguments.

fs/nfs/read.c:38:43: warning: non-ANSI function declaration of function
'nfs_readhdr_alloc'

fs/nfs/read.c +1 -1
index 37c9eb2..f23cf25 100644
@@ -35,7 +35,7 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
 
 static struct kmem_cache *nfs_rdata_cachep;
 
-struct nfs_read_header *nfs_readhdr_alloc()
+struct nfs_read_header *nfs_readhdr_alloc(void)
 {
 	struct nfs_read_header *rhdr;
 
#1 lore raw
Quoted 13 lines · Dan Carpenter

Sparse complains because without the "void", it means that the function takes a variable number of arguments.

fs/nfs/read.c:38:43: warning: non-ANSI function declaration of function
'nfs_readhdr_alloc'

fs/nfs/read.c +0 -0
index 37c9eb2..f23cf25 100644

fs/nfs/read.c static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops; · line 41

Quoted 8 lines
fs/nfs/read.c +1 -1
@@ -35,7 +35,7 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
 
 static struct kmem_cache *nfs_rdata_cachep;
 
-struct nfs_read_header *nfs_readhdr_alloc()
+struct nfs_read_header *nfs_readhdr_alloc(void)
 {
 	struct nfs_read_header *rhdr;
 

Yes. I found that together with a couple of "should this be declared static?" warnings earlier today.

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com

Fix the following sparse warnings:

fs/nfs/direct.c:221:6: warning: symbol 'nfs_direct_readpage_release' was not declared. Should it be static?
fs/nfs/read.c:38:43: warning: non-ANSI function declaration of function 'nfs_readhdr_alloc'
fs/nfs/objlayout/objio_osd.c:214:5: warning: symbol '__alloc_objio_seg' was not declared. Should it be static?

Cc Fred Isaman <[email protected]>
Cc Boaz Harrosh <[email protected]>
---
 fs/nfs/direct.c              |    2 +-
 fs/nfs/objlayout/objio_osd.c |    2 +-
 fs/nfs/read.c                |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
fs/nfs/direct.c +1 -1
index dca9c81..257d009 100644
@@ -218,7 +218,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
 	nfs_direct_req_release(dreq);
 }
 
-void nfs_direct_readpage_release(struct nfs_page *req)
+static void nfs_direct_readpage_release(struct nfs_page *req)
 {
 	dprintk("NFS: direct read done (%s/%lld %d@%lld)\n",
 		req->wb_context->dentry->d_inode->i_sb->s_id,
fs/nfs/objlayout/objio_osd.c +1 -1
index fbf4874..b47277b 100644
@@ -211,7 +211,7 @@ static void copy_single_comp(struct ore_components *oc, unsigned c,
 	memcpy(ocomp->cred, src_comp->oc_cap.cred, sizeof(ocomp->cred));
 }
 
-int __alloc_objio_seg(unsigned numdevs, gfp_t gfp_flags,
+static int __alloc_objio_seg(unsigned numdevs, gfp_t gfp_flags,
 		       struct objio_segment **pseg)
 {
 /*	This is the in memory structure of the objio_segment
fs/nfs/read.c +1 -1
index 37c9eb2..f23cf25 100644
@@ -35,7 +35,7 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
 
 static struct kmem_cache *nfs_rdata_cachep;
 
-struct nfs_read_header *nfs_readhdr_alloc()
+struct nfs_read_header *nfs_readhdr_alloc(void)
 {
 	struct nfs_read_header *rhdr;
 
Signature · 1 line
1.7.7.6