bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: davidcomponentone@gmail.com
To: ast@kernel.org
Cc: davidcomponentone@gmail.com, daniel@iogearbox.net,
	andrii@kernel.org, kafai@fb.com, songliubraving@fb.com,
	yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org,
	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: Fri, 14 Jan 2022 08:07:45 +0800	[thread overview]
Message-ID: <2010e0898586ad83321e8d84181789123e2fe4e4.1642062557.git.davidcomponentone@gmail.com> (raw)

From: Yang Guang <yang.guang5@zte.com.cn>

The coccinelle report
./tools/lib/bpf/libbpf.c:1653: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>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 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 7f10dd501a52..f87787608795 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1650,7 +1650,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


             reply	other threads:[~2022-01-14  0:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14  0:07 davidcomponentone [this message]
2022-01-14  0:37 ` [PATCH] libbpf: remove unneeded conversion to bool Song Liu
  -- strict thread matches above, loose matches on Subject: below --
2024-03-02  0:54 [PATCH] libbpf: Remove " Thorsten Blum
2024-03-02 16:59 ` Yonghong Song
2021-11-25  0:54 [PATCH] libbpf: remove " davidcomponentone
2021-11-25 23:12 ` Daniel Borkmann

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=2010e0898586ad83321e8d84181789123e2fe4e4.1642062557.git.davidcomponentone@gmail.com \
    --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).