Skip to contentSkip to conversation

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

PATCH New H Hartley Sweeten 1 participant 1 message Aug 4, 2009 VFS

lore
Share & tools
lore
#0 lore raw

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

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

---

init/initramfs.c +6 -6
index 4c00edc..893d0b4 100644
@@ -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);