mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, benh@kernel.crashing.org,
	christophe.leroy@csgroup.eu, linux-mm@kvack.org,
	mm-commits@vger.kernel.org, mpe@ellerman.id.au,
	nathan@kernel.org, ndesaulniers@google.com, paulus@samba.org,
	pmenzel@molgen.mpg.de, thunder.leizhen@huawei.com,
	torvalds@linux-foundation.org
Subject: [patch 09/16] lib/zlib_inflate/inffast: check config in C to avoid unused function warning
Date: Fri, 24 Sep 2021 15:43:44 -0700	[thread overview]
Message-ID: <20210924224344.udphYXih4%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org>

From: Paul Menzel <pmenzel@molgen.mpg.de>
Subject: 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/20210920084332.5752-1-pmenzel@molgen.mpg.de
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/zlib_inflate/inffast.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

--- a/lib/zlib_inflate/inffast.c~lib-zlib_inflate-inffast-check-config-in-c-to-avoid-unused-function-warning
+++ a/lib/zlib_inflate/inffast.c
@@ -253,13 +253,12 @@ void inflate_fast(z_streamp strm, unsign
 
 			sfrom = (unsigned short *)(from);
 			loops = len >> 1;
-			do
-#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-			    *sout++ = *sfrom++;
-#else
-			    *sout++ = get_unaligned16(sfrom++);
-#endif
-			while (--loops);
+			do {
+			    if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
+				*sout++ = *sfrom++;
+			    else
+				*sout++ = get_unaligned16(sfrom++);
+			} while (--loops);
 			out = (unsigned char *)sout;
 			from = (unsigned char *)sfrom;
 		    } else { /* dist == 1 or dist == 2 */
_

  parent reply	other threads:[~2021-09-24 22:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 22:42 incoming Andrew Morton
2021-09-24 22:43 ` [patch 01/16] mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable() Andrew Morton
2021-09-24 22:43 ` [patch 02/16] kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS Andrew Morton
2021-09-24 22:43 ` [patch 03/16] mm/damon: don't use strnlen() with known-bogus source length Andrew Morton
2021-09-24 22:43 ` [patch 04/16] xtensa: increase size of gcc stack frame check Andrew Morton
2021-09-24 22:43 ` [patch 05/16] mm/shmem.c: fix judgment error in shmem_is_huge() Andrew Morton
2021-09-24 22:43 ` [patch 06/16] ocfs2: drop acl cache for directories too Andrew Morton
2021-09-24 22:43 ` [patch 07/16] scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error Andrew Morton
2021-09-24 22:43 ` [patch 08/16] tools/vm/page-types: remove dependency on opt_file for idle page tracking Andrew Morton
2021-09-24 22:43 ` Andrew Morton [this message]
2021-09-24 22:43 ` [patch 10/16] mm: fs: invalidate bh_lrus for only cold path Andrew Morton
2021-09-24 22:43 ` [patch 11/16] mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN Andrew Morton
2021-09-24 22:43 ` [patch 12/16] mm/debug: sync up latest migrate_reason to migrate_reason_names Andrew Morton
2021-09-24 22:43 ` [patch 13/16] sh: pgtable-3level: fix cast to pointer from integer of different size Andrew Morton
2021-09-24 22:44 ` [patch 14/16] kasan: always respect CONFIG_KASAN_STACK Andrew Morton
2021-09-24 22:44 ` [patch 15/16] mm/memory_failure: fix the missing pte_unmap() call Andrew Morton
2021-09-24 22:44 ` [patch 16/16] mm: fix uninitialized use in overcommit_policy_handler Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210924224344.udphYXih4%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=paulus@samba.org \
    --cc=pmenzel@molgen.mpg.de \
    --cc=thunder.leizhen@huawei.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).