From: davidcomponentone@gmail.com
To: ast@kernel.org, Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>
Cc: davidcomponentone@gmail.com, netdev@vger.kernel.org,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
Yang Guang <yang.guang5@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH] libbpf: remove unneeded conversion to bool
Date: Thu, 25 Nov 2021 08:54:53 +0800 [thread overview]
Message-ID: <b7449bd983892bb5a7a76493daa41410ff19bb7d.1637736798.git.yang.guang5@zte.com.cn> (raw)
From: Yang Guang <yang.guang5@zte.com.cn>
The coccinelle report
./tools/lib/bpf/libbpf.c:1644:43-48:
WARNING: conversion to bool not needed here
Relational and logical operators evaluate to bool,
explicit conversion is overly verbose and unneeded.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 14a89dc99937..33eb365a0b7f 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1641,7 +1641,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
ext->name, value);
return -EINVAL;
}
- *(bool *)ext_val = value == 'y' ? true : false;
+ *(bool *)ext_val = value == 'y';
break;
case KCFG_TRISTATE:
if (value == 'y')
--
2.30.2
next reply other threads:[~2021-11-25 1:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 0:54 davidcomponentone [this message]
2021-11-25 23:12 ` [PATCH] libbpf: remove unneeded conversion to bool Daniel Borkmann
2022-01-14 0:07 davidcomponentone
2022-01-14 0:37 ` Song Liu
2024-03-02 0:54 [PATCH] libbpf: Remove " Thorsten Blum
2024-03-02 16:59 ` Yonghong Song
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=b7449bd983892bb5a7a76493daa41410ff19bb7d.1637736798.git.yang.guang5@zte.com.cn \
--to=davidcomponentone@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yang.guang5@zte.com.cn \
--cc=yhs@fb.com \
--cc=zealci@zte.com.cn \
/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).