linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nhat Pham <nphamcs@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	 Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Alexey Romanov <avromanov@sberdevices.ru>,
	 "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zsmalloc: avoid unused-function warning
Date: Wed, 18 Jan 2023 11:27:21 -0800	[thread overview]
Message-ID: <CAKEwX=OTpY9Wg6YPfADDqeu7FFzciY9o_nNE5dRR3cu_-2ntaw@mail.gmail.com> (raw)
In-Reply-To: <20230117170507.2651972-1-arnd@kernel.org>

On Tue, Jan 17, 2023 at 9:05 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> obj_allocated() can be called from two places that are each
> inside of an #ifdef. When both are disabled, the compiler warns:
>
> mm/zsmalloc.c:900:13: error: 'obj_allocated' defined but not used [-Werror=unused-function]
>
> Rather than trying to figure out the correct #ifdef, mark the
> trivial function as 'inline', which implies __maybe_unused and
> shuts up the warning.
>
> Fixes: 796c71ac728e ("zsmalloc: fix a race with deferred_handles storing")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nhat Pham <nphamcs@gmail.com>
> ---
>  mm/zsmalloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 723ed56d3fbb..9d27d9b00bce 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -937,7 +937,7 @@ static bool obj_tagged(struct page *page, void *obj, unsigned long *phandle,
>         return true;
>  }
>
> -static bool obj_allocated(struct page *page, void *obj, unsigned long *phandle)
> +static inline bool obj_allocated(struct page *page, void *obj, unsigned long *phandle)
>  {
>         return obj_tagged(page, obj, phandle, OBJ_ALLOCATED_TAG);
>  }
> --
> 2.39.0
>
Tricky one indeed - I definitely missed that. Thanks for the fix!


      parent reply	other threads:[~2023-01-18 19:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 17:04 Arnd Bergmann
2023-01-18  0:39 ` Sergey Senozhatsky
2023-01-18 19:27 ` Nhat Pham [this message]

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='CAKEwX=OTpY9Wg6YPfADDqeu7FFzciY9o_nNE5dRR3cu_-2ntaw@mail.gmail.com' \
    --to=nphamcs@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=avromanov@sberdevices.ru \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=willy@infradead.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