Gang He
2017-May-23 05:17 UTC
[Ocfs2-devel] [PATCH v2] ocfs2: fix a static checker warning
This patch will fix a static code checker warning, which looks like below, fs/ocfs2/inode.c:179 ocfs2_iget() warn: passing zero to 'ERR_PTR' this warning was caused by the commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check"). after apply this patch, the error return value will not be NULL(zero). Signed-off-by: Gang He <ghe at suse.com> --- fs/ocfs2/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 382401d..1a1e007 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno) struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, int sysfile_type) { - int rc = 0; + int rc = -ESTALE; struct inode *inode = NULL; struct super_block *sb = osb->sb; struct ocfs2_find_inode_args args; -- 1.8.5.6
Andrew Morton
2017-May-23 22:30 UTC
[Ocfs2-devel] [PATCH v2] ocfs2: fix a static checker warning
On Tue, 23 May 2017 13:17:14 +0800 Gang He <ghe at suse.com> wrote:> This patch will fix a static code checker warning, which looks > like below, > fs/ocfs2/inode.c:179 ocfs2_iget() > warn: passing zero to 'ERR_PTR' > > this warning was caused by the > commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check"). > after apply this patch, the error return value will not be NULL(zero). > > Signed-off-by: Gang He <ghe at suse.com> > --- > fs/ocfs2/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c > index 382401d..1a1e007 100644 > --- a/fs/ocfs2/inode.c > +++ b/fs/ocfs2/inode.c > @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno) > struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, > int sysfile_type) > { > - int rc = 0; > + int rc = -ESTALE; > struct inode *inode = NULL; > struct super_block *sb = osb->sb; > struct ocfs2_find_inode_args args;hm, OK, thanks. The resulting code still looks rather weird. Could someone who works in this area please take a look?
Eric Ren
2017-May-24 06:17 UTC
[Ocfs2-devel] [PATCH v2] ocfs2: fix a static checker warning
On 05/23/2017 01:17 PM, Gang He wrote:> This patch will fix a static code checker warning, which looks > like below, > fs/ocfs2/inode.c:179 ocfs2_iget() > warn: passing zero to 'ERR_PTR' > > this warning was caused by the > commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check"). > after apply this patch, the error return value will not be NULL(zero). > > Signed-off-by: Gang He <ghe at suse.com>Looks good to me. Reviewed-by: Eric Ren <zren at suse.com>> --- > fs/ocfs2/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c > index 382401d..1a1e007 100644 > --- a/fs/ocfs2/inode.c > +++ b/fs/ocfs2/inode.c > @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno) > struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, > int sysfile_type) > { > - int rc = 0; > + int rc = -ESTALE; > struct inode *inode = NULL; > struct super_block *sb = osb->sb; > struct ocfs2_find_inode_args args;