[PATCH] init/initramfs.c: fix "symbol shadows an earlier one" noise

From: H Hartley Sweeten
Date: Tue Aug 04 2009 - 16:34:20 EST


The symbol 'count' is a static global variable used when unpacking the
rootfs. Function clean_rootfs() uses this same symbol name locally
while walking the directory entries to clean the rootfs. This results in
the following sparse warnings:

init/initramfs.c:526:13: warning: symbol 'count' shadows an earlier one
init/initramfs.c:167:28: originally declared here

Fix this by renaming the symbol in clean_rootfs().

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>

---

diff --git a/init/initramfs.c b/init/initramfs.c
index 4c00edc..893d0b4 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -523,7 +523,7 @@ static void __init clean_rootfs(void)
int fd;
void *buf;
struct linux_dirent64 *dirp;
- int count;
+ int dents_count;

fd = sys_open("/", O_RDONLY, 0);
WARN_ON(fd < 0);
@@ -537,9 +537,9 @@ static void __init clean_rootfs(void)
}

dirp = buf;
- count = sys_getdents64(fd, dirp, BUF_SIZE);
- while (count > 0) {
- while (count > 0) {
+ dents_count = sys_getdents64(fd, dirp, BUF_SIZE);
+ while (dents_count > 0) {
+ while (dents_count > 0) {
struct stat st;
int ret;

@@ -552,12 +552,12 @@ static void __init clean_rootfs(void)
sys_unlink(dirp->d_name);
}

- count -= dirp->d_reclen;
+ dents_count -= dirp->d_reclen;
dirp = (void *)dirp + dirp->d_reclen;
}
dirp = buf;
memset(buf, 0, BUF_SIZE);
- count = sys_getdents64(fd, dirp, BUF_SIZE);
+ dents_count = sys_getdents64(fd, dirp, BUF_SIZE);
}

sys_close(fd);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/