From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD20AA034F; Tue, 11 Jan 2022 16:12:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C7D04272B; Tue, 11 Jan 2022 16:12:58 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8DC0B41143 for ; Tue, 11 Jan 2022 16:12:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641913976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YH0XdcP8I37W+UG8fZ0LbQHB1XOBDQzkG6wDUAAMKao=; b=de+J6mTloPRfKrzy/v+vI103S5RKblnTMyl144vtNkY1wWsPoPxvL5ScimoijSrLaZoLLK MKztjZWB41F8RFOjGm9zioaGQcEqWhGOxaBNxNfvO+yuqu9q0oZxWy391nCpPvrLpJlYT5 x7DsBWLIfW7WAko/5ETzgMlVnBis17g= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-117-jWdnl7iBNM-GieJXbyQZDQ-1; Tue, 11 Jan 2022 10:12:38 -0500 X-MC-Unique: jWdnl7iBNM-GieJXbyQZDQ-1 Received: by mail-wm1-f69.google.com with SMTP id z13-20020a05600c0a0d00b003457d6619f8so1975553wmp.1 for ; Tue, 11 Jan 2022 07:12:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=YH0XdcP8I37W+UG8fZ0LbQHB1XOBDQzkG6wDUAAMKao=; b=OLeGYFymD3obVNsOZM9dcmA5Jmn/O7a4/Fe0HVB7Hs1A5vQg9SnBXdWddv/JslqaSm hBXMpOpzYh+lWQIBEX75k5RXi0B+IDMMyDppam19Bmm29eB7o6AUNPXDlycoQ81vIiF+ cWiiTLhZATbdZJv3vdHhNKtQVauLxq+uUROkcclJ3ncAqhFKa0XiB0Yx+7Mo1Gyjy9Ce 6nnmGI8x0tbrbPHkcJThEi5LpxoK+39oP6CxzYcOhywDUWrB0Zu/+o0pNFsl0cgtchx1 wMIofZZ3/oW0FjGF8vVYBtxacBRGwqWCzg2fGujN2zGk8beLGgOCsJLZWtYyZmKGtH0+ Q79w== X-Gm-Message-State: AOAM533RFjXzbOqywX+AUSHmI7t7ujDtagVh8mZWgDXSRCAcDomrmZH7 lxqxvuJrSkVOqd9y6kay+YlNOByAKk2PddG+MTwCk6rRYAWb1PMngvSUPUYdnQc7Do9FzhZizfB FmXo= X-Received: by 2002:a05:600c:4f91:: with SMTP id n17mr2868005wmq.195.1641913957270; Tue, 11 Jan 2022 07:12:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4iwjwDjbf3luPE5X8+PT5aaw3TR1Ih9HD7n/z4TnYfE6PmuiAuEsRJd23FcywVkYmZXC3dQ== X-Received: by 2002:a05:600c:4f91:: with SMTP id n17mr2867992wmq.195.1641913957124; Tue, 11 Jan 2022 07:12:37 -0800 (PST) Received: from [192.168.0.36] ([78.19.108.41]) by smtp.gmail.com with ESMTPSA id w7sm3976261wrv.96.2022.01.11.07.12.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jan 2022 07:12:36 -0800 (PST) Message-ID: <93fa972f-1465-1c5f-2a76-16a5a098f6de@redhat.com> Date: Tue, 11 Jan 2022 15:12:35 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 To: Maxime Gouin , dev@dpdk.org Cc: Rosen Xu , Qi Zhang , Tianfei Zhang , Olivier Matz References: <20220105102652.6400-1-maxime.gouin@6wind.com> From: Kevin Traynor Subject: Re: [PATCH] bus/ifpga: remove useless check while browsing devices In-Reply-To: <20220105102652.6400-1-maxime.gouin@6wind.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 05/01/2022 10:26, Maxime Gouin wrote: > reported by code analysis tool C++test (version 10.4): > >> /build/dpdk-20.11/drivers/bus/ifpga/ifpga_bus.c >> 67 Condition "afu_dev" is always evaluated to true >> 81 Condition "afu_dev" is always evaluated to true > > The "for" loop already checks that afu_dev is not NULL. > > Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") > Cc: stable@dpdk.org > Signed-off-by: Maxime Gouin > Reviewed-by: Olivier Matz Acked-by: Kevin Traynor > --- > drivers/bus/ifpga/ifpga_bus.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c > index cbc680928486..c5c8bbd57219 100644 > --- a/drivers/bus/ifpga/ifpga_bus.c > +++ b/drivers/bus/ifpga/ifpga_bus.c > @@ -64,8 +64,7 @@ ifpga_find_afu_dev(const struct rte_rawdev *rdev, > struct rte_afu_device *afu_dev = NULL; > > TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) { > - if (afu_dev && > - afu_dev->rawdev == rdev && > + if (afu_dev->rawdev == rdev && > !ifpga_afu_id_cmp(&afu_dev->id, afu_id)) > return afu_dev; > } > @@ -78,8 +77,7 @@ rte_ifpga_find_afu_by_name(const char *name) > struct rte_afu_device *afu_dev = NULL; > > TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) { > - if (afu_dev && > - !strcmp(afu_dev->device.name, name)) > + if (!strcmp(afu_dev->device.name, name)) > return afu_dev; > } > return NULL; >