Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1582046pxb; Fri, 6 Nov 2020 13:34:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzu3iwrndkLgyAEn1dJM2A3QMHOZEqHFAYCQQsCmpIiZXXypVYpxB0S8p497eBe7mbc3Fmm X-Received: by 2002:a17:906:b841:: with SMTP id ga1mr4032292ejb.29.1604698482396; Fri, 06 Nov 2020 13:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604698482; cv=none; d=google.com; s=arc-20160816; b=YOTWu0jQXbRmGIhVcQkr3RppUfgcf4to+0BiijwF/F1a0wRiymGdC9SGSgb9utXLZd YdR7Oxg2idkpSLsM4hqd7mLY79MJd3rVhtccWzpAvGy2hhh9bF93Bn3f88/Pn9RGzKW9 EtXH5Bc07iezFKr/+aBZmK1JzScMwzW5YR0Xmcuh9rht4ehNUwfjUM2YZ0f6+EnhicgL RrOMtCj+WVyOxgO0iOfHFFyt51ywMYbvllBdfw70EU1AuKyPbMm8KaPqWovQSqheHQkZ sK3u8Nfo1jfzh3MQwMcyGCs4d5H14qnZ/Ew8s8JtbBOewAq01YT4Xb0mV2Uf6bF8ExL4 gMnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cHcHgXcRJlXjahuwxlXNQLlz52MRv1C06pV1zHy8MSY=; b=IzUuhRLXh5gYRhYcHeKUjDYc6jk509/+xbBLuik8jVQ1YlStdQuThpZSUX+rBVTfO6 GA/Vhda/+D4unP/13/4wPNP3kJc/hO+BnpOSd1rRko6vdXd8OTF8bfaU9WV5sxDmbaE/ uu2SBiG0+C2z9Np4Hp+Al+OycVatbdIi+d0ZPgaRyAyA4pfnjB7t/RTsIn+R0kdIeaBe STDQwu4QeyzY2Kh3Gfbm7hzBNxcnLyTRVTf2+khhHck+SfIb8K1P3nOvhHEWqLFSSI7z 2qhOxiXIDY4Flt9ls9cmX+pToceCLYtNJkumOZZ0FyW19XJW70FcWp/suo+//s2elPl7 sHHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rg3fB6qr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si2154667ejd.682.2020.11.06.13.34.19; Fri, 06 Nov 2020 13:34:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rg3fB6qr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728259AbgKFVcz (ORCPT + 99 others); Fri, 6 Nov 2020 16:32:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728096AbgKFVcy (ORCPT ); Fri, 6 Nov 2020 16:32:54 -0500 Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF531C0613CF; Fri, 6 Nov 2020 13:32:54 -0800 (PST) Received: by mail-yb1-xb43.google.com with SMTP id a12so2372291ybg.9; Fri, 06 Nov 2020 13:32:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cHcHgXcRJlXjahuwxlXNQLlz52MRv1C06pV1zHy8MSY=; b=Rg3fB6qrZs8sy2GckFNiyCIx74uH5F+E9NTYX6KH8N17ObhUlXAPisch75/UgzIsLr 6rt8q8JbGgqNbq0NZpzNvRUemywChuv6VU2Lrbm8F5zPZpJnaiUe0PL9rLVpBgEnbCrh ood+6cqWsRHzhHchp9U8MVTsxMnb3+ONSzZS/A4/I8rntqTfBHoDGaj7L00LXEFZfJVw 5RH0tvJ2VFBPVmoa1FIlkle6npURscxHBoOLFbvhtJaIdEC8748jeqwYyoCh5lHPw9qp vngsQaV4rvGbRzIFAHrYE0W6zDlTBcVoFvV8q66Xnu1saK4RMJ2NrrLMhV0POuymlOcL UFGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cHcHgXcRJlXjahuwxlXNQLlz52MRv1C06pV1zHy8MSY=; b=X6HX/nhjgjwQ6X5eaNY0fknVXB0+3a+1sY/Ayu0YlRNvDRTlveLrgyxWbbtixhgfn7 gJ7f7JZrEoi39FfG1o5f4PJNnADAw0c79R83lQkhT/LlBp3akc8xuYuLWQ7FtegEWMIN yREm/3qH6rzS7aE0E9snYErZznvWXGu/UcC2Xcmih/qIc0V4iRTQkiuqDeSDjcqPNL7d wZjU6bvHzCFwByVfK+LibagOxNt5KxngHPuHYSHNhUeI/5nXV7OBst2NtdSNSQggme9y tpSTzEhzAuSsmi0+FPDk1xlyaW2MJjiTIWrsmf5QdBViHiihmh3ttDglXhvNA7zAPi2C lhFA== X-Gm-Message-State: AOAM533+yyDZpCOrWsI6yTsZqokxp6rsupAE5yqLgOkrD2K2z2tHmPvW aSsDeKDTTEsyCzlZJgR/c57fISJnXDgRJfDnXqk= X-Received: by 2002:a25:da4e:: with SMTP id n75mr5615969ybf.425.1604698374190; Fri, 06 Nov 2020 13:32:54 -0800 (PST) MIME-Version: 1.0 References: <1604646759-785-1-git-send-email-kaixuxia@tencent.com> In-Reply-To: <1604646759-785-1-git-send-email-kaixuxia@tencent.com> From: Andrii Nakryiko Date: Fri, 6 Nov 2020 13:32:43 -0800 Message-ID: Subject: Re: [PATCH] libbpf: Remove unnecessary conversion to bool To: xiakaixu1987@gmail.com Cc: Alexei Starovoitov , Daniel Borkmann , Martin Lau , Song Liu , Yonghong Song , Andrii Nakryiko , Networking , bpf , open list , Kaixu Xia Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 5, 2020 at 11:12 PM wrote: > > From: Kaixu Xia > > Fix following warning from coccinelle: > > ./tools/lib/bpf/libbpf.c:1478:43-48: WARNING: conversion to bool not needed here > > Signed-off-by: Kaixu Xia > --- > 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 313034117070..fb9625077983 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -1475,7 +1475,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'; I actually did this intentionally. x = y == z; pattern looked too obscure to my taste, tbh. > break; > case KCFG_TRISTATE: > if (value == 'y') > -- > 2.20.0 >