LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] affs: fix shadowed variable sparse warnings
@ 2008-02-09  2:53 Harvey Harrison
  2008-02-09  3:01 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Harvey Harrison @ 2008-02-09  2:53 UTC (permalink / raw)
  To: Roman Zippel; +Cc: Andrew Morton, LKML

Introduce _tmp in the small if-blocks where this is shadowed.
fs/affs/file.c:573:8: warning: symbol 'tmp' shadows an earlier one
fs/affs/file.c:530:6: originally declared here
fs/affs/file.c:714:9: warning: symbol 'tmp' shadows an earlier one
fs/affs/file.c:661:6: originally declared here
fs/affs/file.c:746:9: warning: symbol 'tmp' shadows an earlier one
fs/affs/file.c:661:6: originally declared here

Remove declaration and assign to original variable as we are going
to return from the function at this point anyway.
fs/affs/file.c:831:7: warning: symbol 'size' shadows an earlier one
fs/affs/file.c:813:6: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
Roman, any interest?

 fs/affs/file.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/affs/file.c b/fs/affs/file.c
index 6e0c939..ac05dc2 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -570,11 +570,11 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize)
 		bh->b_state &= ~(1UL << BH_New);
 		mark_buffer_dirty_inode(bh, inode);
 		if (prev_bh) {
-			u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
-			if (tmp)
-				affs_warning(sb, "extent_file_ofs", "next block already set for %d (%d)", bidx, tmp);
+			u32 _tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
+			if (_tmp)
+				affs_warning(sb, "extent_file_ofs", "next block already set for %d (%d)", bidx, _tmp);
 			AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr);
-			affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp);
+			affs_adjust_checksum(prev_bh, bh->b_blocknr - _tmp);
 			mark_buffer_dirty_inode(prev_bh, inode);
 			affs_brelse(prev_bh);
 		}
@@ -711,11 +711,11 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
 			AFFS_DATA_HEAD(bh)->next = 0;
 			bh->b_state &= ~(1UL << BH_New);
 			if (prev_bh) {
-				u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
-				if (tmp)
-					affs_warning(sb, "commit_write_ofs", "next block already set for %d (%d)", bidx, tmp);
+				u32 _tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
+				if (_tmp)
+					affs_warning(sb, "commit_write_ofs", "next block already set for %d (%d)", bidx, _tmp);
 				AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr);
-				affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp);
+				affs_adjust_checksum(prev_bh, bh->b_blocknr - _tmp);
 				mark_buffer_dirty_inode(prev_bh, inode);
 			}
 		}
@@ -743,11 +743,11 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
 			AFFS_DATA_HEAD(bh)->next = 0;
 			bh->b_state &= ~(1UL << BH_New);
 			if (prev_bh) {
-				u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
-				if (tmp)
-					affs_warning(sb, "commit_write_ofs", "next block already set for %d (%d)", bidx, tmp);
+				u32 _tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
+				if (_tmp)
+					affs_warning(sb, "commit_write_ofs", "next block already set for %d (%d)", bidx, _tmp);
 				AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr);
-				affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp);
+				affs_adjust_checksum(prev_bh, bh->b_blocknr - _tmp);
 				mark_buffer_dirty_inode(prev_bh, inode);
 			}
 		} else if (be32_to_cpu(AFFS_DATA_HEAD(bh)->size) < tmp)
@@ -828,8 +828,8 @@ affs_truncate(struct inode *inode)
 		struct address_space *mapping = inode->i_mapping;
 		struct page *page;
 		void *fsdata;
-		u32 size = inode->i_size;
 		int res;
+		size = inode->i_size;
 
 		res = mapping->a_ops->write_begin(NULL, mapping, size, 0, 0, &page, &fsdata);
 		if (!res)
-- 
1.5.4.1219.g65b9




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] affs: fix shadowed variable sparse warnings
  2008-02-09  2:53 [PATCH] affs: fix shadowed variable sparse warnings Harvey Harrison
@ 2008-02-09  3:01 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2008-02-09  3:01 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Roman Zippel, Andrew Morton, LKML

On Fri, 2008-02-08 at 18:53 -0800, Harvey Harrison wrote:
> diff --git a/fs/affs/file.c b/fs/affs/file.c
> index 6e0c939..ac05dc2 100644
> --- a/fs/affs/file.c
> +++ b/fs/affs/file.c
> @@ -570,11 +570,11 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize)
>  		bh->b_state &= ~(1UL << BH_New);
>  		mark_buffer_dirty_inode(bh, inode);
>  		if (prev_bh) {
> -			u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
> -			if (tmp)
> -				affs_warning(sb, "extent_file_ofs", "next block already set for %d (%d)", bidx, tmp);
> +			u32 _tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);

Perhaps u32 next = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-09  3:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-09  2:53 [PATCH] affs: fix shadowed variable sparse warnings Harvey Harrison
2008-02-09  3:01 ` Joe Perches

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).