- fixed a Sparse warning (patch received from Dan Carpenter) - make use of unlikely() at some places Signed-off-by: Kai Bankett<chaosman@xxxxxxxxxx> --- fs/qnx6/README | 1 + fs/qnx6/dir.c | 14 +++++++------- fs/qnx6/inode.c | 10 +++++----- fs/qnx6/namei.c | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/fs/qnx6/README b/fs/qnx6/README index 116d622..fbd910b 100644 --- a/fs/qnx6/README +++ b/fs/qnx6/README @@ -4,5 +4,6 @@ Credits : +Dan Carpenter <dan.carpenter@xxxxxxxxxx> (__force to silence a Sparse warning) Al Viro <viro@xxxxxxxxxxxxxxxxxx> (endless patience with me& support ;)) Kai Bankett <chaosman@xxxxxxxxxx> (Maintainer) diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index dc59735..faa0afe 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c @@ -57,7 +57,7 @@ static struct qnx6_long_filename *qnx6_longname(struct super_block *sb, u32 offs = (s<< sb->s_blocksize_bits)& ~PAGE_CACHE_MASK; struct address_space *mapping = sbi->longfile->i_mapping; struct page *page = read_mapping_page(mapping, n, NULL); - if (IS_ERR(page)) + if (unlikely(IS_ERR(page))) return ERR_CAST(page); kmap(*p = page); return (struct qnx6_long_filename *)(page_address(page) + offs); @@ -74,7 +74,7 @@ static int qnx6_dir_longfilename(struct inode *inode, struct page *page; int lf_size; - if (de->de_size != 0xff) { + if (unlikely(de->de_size != 0xff)) { /* error - long filename entries always have size 0xff in direntry */ printk(KERN_ERR "qnx6: invalid direntry size (%i).\n", @@ -82,14 +82,14 @@ static int qnx6_dir_longfilename(struct inode *inode, return 0; } lf = qnx6_longname(s, de,&page); - if (IS_ERR(lf)) { + if (unlikely(IS_ERR(lf))) { printk(KERN_ERR "qnx6:Error reading longname\n"); return 0; } lf_size = fs16_to_cpu(sbi, lf->lf_size); - if (lf_size> QNX6_LONG_NAME_MAX) { + if (unlikely(lf_size> QNX6_LONG_NAME_MAX)) { QNX6DEBUG((KERN_INFO "file %s\n", lf->lf_fname)); printk(KERN_ERR "qnx6:Filename too long (%i)\n", lf_size); qnx6_put_page(page); @@ -135,7 +135,7 @@ static int qnx6_readdir(struct file *filp, void *dirent, filldir_t filldir) struct qnx6_dir_entry *de; int i = start; - if (IS_ERR(page)) { + if (unlikely(IS_ERR(page))) { printk(KERN_ERR "qnx6_readdir: read failed\n"); filp->f_pos = (n + 1)<< PAGE_CACHE_SHIFT; return PTR_ERR(page); @@ -189,7 +189,7 @@ static unsigned qnx6_long_match(int len, const char *name, int thislen; struct qnx6_long_filename *lf = qnx6_longname(s, de,&page); - if (IS_ERR(lf)) + if (unlikely(IS_ERR(lf))) return 0; thislen = fs16_to_cpu(sbi, lf->lf_size); @@ -241,7 +241,7 @@ unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, do { page = qnx6_get_page(dir, n); - if (!IS_ERR(page)) { + if (likely(!IS_ERR(page))) { int limit = last_entry(dir, n); int i; diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index e44012d..56d0810 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c @@ -85,7 +85,7 @@ static int qnx6_get_block(struct inode *inode, sector_t iblock, static int qnx6_check_blockptr(__fs32 ptr) { - if (ptr == ~(__fs32)0) { + if (ptr == ~(__force __fs32)0) { printk(KERN_ERR "qnx6: hit unused blockpointer.\n"); return 0; } @@ -135,7 +135,7 @@ static unsigned qnx6_block_map(struct inode *inode, unsigned no) for (i = 0; i< depth; i++) { bh = sb_bread(s, block); - if (!bh) { + if (unlikely(!bh)) { printk(KERN_ERR "qnx6:Error reading block (%u)\n", block); return 0; @@ -553,7 +553,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino) inode->i_mode = 0; - if (ino == 0) { + if (unlikely(ino == 0)) { printk(KERN_ERR "qnx6: bad inode number on dev %s: %u is " "out of range\n", sb->s_id, ino); @@ -564,7 +564,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino) offs = (ino - 1)& (~PAGE_CACHE_MASK>> QNX6_INODE_SIZE_BITS); mapping = sbi->inodes->i_mapping; page = read_mapping_page(mapping, n, NULL); - if (IS_ERR(page)) { + if (unlikely(IS_ERR(page))) { printk(KERN_ERR "qnx6: major problem: unable to read inode from " "dev %s\n", sb->s_id); iget_failed(inode); @@ -614,7 +614,7 @@ static struct inode *qnx6_alloc_inode(struct super_block *sb) { struct qnx6_inode_info *ei; ei = kmem_cache_alloc(qnx6_inode_cachep, GFP_KERNEL); - if (!ei) + if (unlikely(!ei)) return NULL; return&ei->vfs_inode; } diff --git a/fs/qnx6/namei.c b/fs/qnx6/namei.c index 8a97289..97af200 100644 --- a/fs/qnx6/namei.c +++ b/fs/qnx6/namei.c @@ -21,14 +21,14 @@ struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, const char *name = dentry->d_name.name; int len = dentry->d_name.len; - if (len> QNX6_LONG_NAME_MAX) + if (unlikely(len> QNX6_LONG_NAME_MAX)) return ERR_PTR(-ENAMETOOLONG); ino = qnx6_find_entry(len, dir, name,&page); if (ino) { foundinode = qnx6_iget(dir->i_sb, ino); qnx6_put_page(page); - if (IS_ERR(foundinode)) { + if (unlikely(IS_ERR(foundinode))) { QNX6DEBUG((KERN_ERR "qnx6: lookup->iget -> " " error %ld\n", PTR_ERR(foundinode))); return ERR_CAST(foundinode); -- 1.7.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html