From: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
To: Nathan Chancellor <natechancellor@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"clang-built-linux@googlegroups.com"
<clang-built-linux@googlegroups.com>
Subject: RE: [PATCH] mm: cma: Return cma->name directly in cma_get_name
Date: Tue, 23 Jun 2020 02:07:15 +0000 [thread overview]
Message-ID: <B926444035E5E2439431908E3842AFD2516153@DGGEMI525-MBS.china.huawei.com> (raw)
In-Reply-To: <20200623015840.621964-1-natechancellor@gmail.com>
> -----Original Message-----
> From: Nathan Chancellor [mailto:natechancellor@gmail.com]
> Sent: Tuesday, June 23, 2020 1:59 PM
> To: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org; linux-kernel@vger.kernel.org;
> clang-built-linux@googlegroups.com; Song Bao Hua (Barry Song)
> <song.bao.hua@hisilicon.com>; Nathan Chancellor
> <natechancellor@gmail.com>
> Subject: [PATCH] mm: cma: Return cma->name directly in cma_get_name
>
> clang warns:
>
> mm/cma.c:55:14: warning: address of array 'cma->name' will always
> evaluate to 'true' [-Wpointer-bool-conversion]
> return cma->name ? cma->name : "(undefined)";
> ~~~~~^~~~ ~
> 1 warning generated.
>
> After commit e7f0557d7de9 ("mm: cma: fix the name of CMA areas"),
> cma->name will be an array with some value worth printing so we do not
> need to check for NULL.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1063
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Thanks!
Acked-by: Barry Song <song.bao.hua@hisilicon.com>
> ---
> mm/cma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index 31a61d410c59..6cf08817bac6 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -52,7 +52,7 @@ unsigned long cma_get_size(const struct cma *cma)
>
> const char *cma_get_name(const struct cma *cma)
> {
> - return cma->name ? cma->name : "(undefined)";
> + return cma->name;
> }
>
> static unsigned long cma_bitmap_aligned_mask(const struct cma *cma,
>
> base-commit: 27f11fea33608cbd321a97cbecfa2ef97dcc1821
> --
> 2.27.0
prev parent reply other threads:[~2020-06-23 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 1:58 [PATCH] mm: cma: Return cma->name directly in cma_get_name Nathan Chancellor
2020-06-23 2:07 ` Song Bao Hua (Barry Song) [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=B926444035E5E2439431908E3842AFD2516153@DGGEMI525-MBS.china.huawei.com \
--to=song.bao.hua@hisilicon.com \
--cc=akpm@linux-foundation.org \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=natechancellor@gmail.com \
/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).