Skip to contentSkip to conversation

initramfs: mask my_inptr as __initdata

PATCH Applied wuchi 2 participants 2 messages Aug 27, 2022 – Aug 28, 2022 VFS

lore
Share & tools
lore

wuchi

author
#0 lore raw

PATCH 1/1 initramfs: mask my_inptr as __initdata

As my_inptr is only used in __init function unpack_to_rootfs(), mark it as __initdata to allow it be freed after boot.

---
 init/initramfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
init/initramfs.c +1 -1
index 18229cfe8906..2f5bfb7d7652 100644
@@ -482,7 +482,7 @@ static long __init flush_buffer(void *bufv, unsigned long len)
 	return origLen;
 }
 
-static unsigned long my_inptr; /* index of next byte to be processed in inbuf */
+static unsigned long my_inptr __initdata; /* index of next byte to be processed in inbuf */
 
 #include <linux/decompress/generic.h>
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · wuchi

As my_inptr is only used in __init function unpack_to_rootfs(), mark it as __initdata to allow it be freed after boot.

---
 init/initramfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
init/initramfs.c +0 -0
index 18229cfe8906..2f5bfb7d7652 100644

init/initramfs.c static long __init flush_buffer(void *bufv, unsigned long len) · line 488

Quoted 8 lines
init/initramfs.c +1 -1
@@ -482,7 +482,7 @@ static long __init flush_buffer(void *bufv, unsigned long len)
 	return origLen;
 }
 
-static unsigned long my_inptr; /* index of next byte to be processed in inbuf */
+static unsigned long my_inptr __initdata; /* index of next byte to be processed in inbuf */
 
 #include <linux/decompress/generic.h>
 

Looks fine.