Skip to content

Commit b7cd9fa

Browse files
paulmenzeltorvalds
authored andcommitted
lib/zlib_inflate/inffast: check config in C to avoid unused function warning
Building Linux for ppc64le with Ubuntu clang version 12.0.0-3ubuntu1~21.04.1 shows the warning below. arch/powerpc/boot/inffast.c:20:1: warning: unused function 'get_unaligned16' [-Wunused-function] get_unaligned16(const unsigned short *p) ^ 1 warning generated. Fix it by moving the check from the preprocessor to C, so the compiler sees the use. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Paul Menzel <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Zhen Lei <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ebaeab2 commit b7cd9fa

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/zlib_inflate/inffast.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,12 @@ void inflate_fast(z_streamp strm, unsigned start)
253253

254254
sfrom = (unsigned short *)(from);
255255
loops = len >> 1;
256-
do
257-
#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
258-
*sout++ = *sfrom++;
259-
#else
260-
*sout++ = get_unaligned16(sfrom++);
261-
#endif
262-
while (--loops);
256+
do {
257+
if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
258+
*sout++ = *sfrom++;
259+
else
260+
*sout++ = get_unaligned16(sfrom++);
261+
} while (--loops);
263262
out = (unsigned char *)sout;
264263
from = (unsigned char *)sfrom;
265264
} else { /* dist == 1 or dist == 2 */

0 commit comments

Comments
 (0)