Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

initrd: Fix unused variable warning in rd_load_image() on s390

The local variables 'rotator' and 'rotate' (used for the progress
indicator) aren't used on s390. Building the kernel with W=1 generates
the following warning:

init/do_mounts_rd.c:192:17: warning: variable 'rotate' set but not used [-Wunused-but-set-variable]
192 | unsigned short rotate = 0;
| ^
1 warning generated.

Remove the preprocessor directives and use the IS_ENABLED(CONFIG_S390)
macro instead, allowing the compiler to optimize away unused variables
and avoid the warning on s390.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Thorsten Blum and committed by
Christian Brauner
84f1766b af67f4c1

+1 -5
+1 -5
init/do_mounts_rd.c
··· 191 191 char *buf = NULL; 192 192 unsigned short rotate = 0; 193 193 decompress_fn decompressor = NULL; 194 - #if !defined(CONFIG_S390) 195 194 char rotator[4] = { '|' , '/' , '-' , '\\' }; 196 - #endif 197 195 198 196 out_file = filp_open("/dev/ram", O_RDWR, 0); 199 197 if (IS_ERR(out_file)) ··· 253 255 } 254 256 kernel_read(in_file, buf, BLOCK_SIZE, &in_pos); 255 257 kernel_write(out_file, buf, BLOCK_SIZE, &out_pos); 256 - #if !defined(CONFIG_S390) 257 - if (!(i % 16)) { 258 + if (!IS_ENABLED(CONFIG_S390) && !(i % 16)) { 258 259 pr_cont("%c\b", rotator[rotate & 0x3]); 259 260 rotate++; 260 261 } 261 - #endif 262 262 } 263 263 pr_cont("done.\n"); 264 264