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 34088A0A0E; Tue, 11 May 2021 15:25:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B37E340140; Tue, 11 May 2021 15:25:35 +0200 (CEST) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by mails.dpdk.org (Postfix) with ESMTP id 7DE354003E for ; Tue, 11 May 2021 15:25:34 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 53D2610D4; Tue, 11 May 2021 09:25:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 11 May 2021 09:25:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= kDRS4fL96wPOeHJmzjrMP30uF4SjIdTZ9cxpIwcLdR0=; b=FXdrXVQMbcpTY/vZ 3pWOGtN3LW4uOuoHQ3FOvKM3TDbkN8+FXPoLPg0lqwzsTEPy9az70FsFwToV8Oo1 ms9+jSNU8G1zC579+GCWD1oJ8p1JFF+sy1SKXuRMRP29unw8LOeuMuLtAyUJfb+N NkTb4siLzhziFc+/kViaLWwcg8MEdmZK5+SHgfdeAULCXGA0w7OuR/IvM29hjuSQ klxtuu64zC5pqP1Bvf6SnieiXe3KnG8sBn5cjMxSVrmMm/CNODOtGg/lOqEWYNFr rFGrAp0qPcesGHCqD52z5khSYSK4ApzPhu6EjEOLogEqUlYrNUdfGre9VAFqT9FE PWktqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=kDRS4fL96wPOeHJmzjrMP30uF4SjIdTZ9cxpIwcLd R0=; b=MMEuvUztKI4+Z32Ubh0YD739VvLMipnIemN5ZcD7Y9Asg/VuUijd5WcI0 FLDpQzE8irlNRY3OiY3i5ufcCBvq6+ZXAeZVYugrHeJorDVholQqBH04D5XK1zCT 0lKKTxawi5wVE+mhXMar15esswBUgeOrwrz6gjn4UOSbmCpsKWPd6FY7nUhg58ls 6v3Y33g/JGs/hd3vu0rglyPAEixEKjNV3xzUFixHFrvRkSlvIPAn8PP/AGWm8fPU oilztPoxmeJKWjlk/BMSEBayNG9oZm1oSrQdD4Re+hgp13mlIB4maektfbp/uALJ YYJAJ95hXsLS/AIeh2YcE/wrZPg9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehtddgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtqhertddttdejnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepkeethedtieevhfeigeejleegudefjeehkeekteeuveeiuedvveeu tdejveehveetnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 May 2021 09:25:31 -0400 (EDT) From: Thomas Monjalon To: "Pattan, Reshma" , "Hunt, David" Cc: "dev@dpdk.org" , "Yigit, Ferruh" , "Min Hu (Connor)" Date: Tue, 11 May 2021 15:25:30 +0200 Message-ID: <1821297.yTpHVI7bYs@thomas> In-Reply-To: References: <1619355594-15223-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check 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 Sender: "dev" Any comment please? 29/04/2021 02:43, Min Hu (Connor): >=20 > =E5=9C=A8 2021/4/28 23:13, Pattan, Reshma =E5=86=99=E9=81=93: > >=20 > >=20 > >> -----Original Message----- > >> From: dev On Behalf Of Min Hu (Connor) > >> > >> + if (lcore_id >=3D RTE_MAX_LCORE) { > >> + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range > >> 0...%d\n", > >> + lcore_id, RTE_MAX_LCORE-1); > >> + return -1; > >> + } > >> + > >=20 > > This looks good. > >=20 > >> fds.fd =3D global_fds[lcore_id]; > >> fds.events =3D POLLIN; > >> > > > >=20 > >> if (global_fds[lcore_id] < 0) { > >> RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not > >> connected\n"); > >=20 > >=20 > > Another suggestion if you would like to improve the code, is below, > > You can move "global_fds[lcore_id]" check to immediate after the line= "fds.fd =3D global_fds[lcore_id]; " > Hi, thanks Pattan. > But I think "global_fds[lcore_id]" check may move before the line=20 > "fds.fd =3D global_fds[lcore_id]; > If it failed, "fds.fd =3D global_fds[lcore_id];" should not be performed. > What's your opinion? >=20 > >=20 > > Reviewed-by: Reshma Pattan