From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
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 <dev@dpdk.org>; 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: <xms:zIWaYALuf6FNejCPZmxUer5VVR2Pb8IEtEociXfBcbd_RHcEE4Qizw>
 <xme:zIWaYAI_HCGD0f3zevwOsyy-N4yrsGjoff3d1h5L1yAoW_vOjBW5wgawvBUuom-Ai
 sRkevq4vGUwSw5-cQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehtddgieehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkfgjfhgggfgtsehtqhertddttdejnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg
 ftrfgrthhtvghrnhepkeethedtieevhfeigeejleegudefjeehkeekteeuveeiuedvveeu
 tdejveehveetnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf
 hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl
 ohhnrdhnvght
X-ME-Proxy: <xmx:zIWaYAv42kI27QovScPIaGSASkwX1JQYuP_KXPfCLhf4uX9b_GNLDg>
 <xmx:zIWaYNbqHKuD4qe2Hg7U09bV6stRxmu3N9wRHwBBlVwjz8t_tWN7EQ>
 <xmx:zIWaYHYF2CNW60MWRJdTNB5o5F2SzOYwD5--_DbMpIWeCfPckyTxyQ>
 <xmx:zIWaYGkLFptZUoX8gApedpf13YLYbgwkkyCsGtd_cQN8eI1vNOLzFw>
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 <thomas@monjalon.net>
To: "Pattan, Reshma" <reshma.pattan@intel.com>, "Hunt,
 David" <david.hunt@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
 "Min Hu (Connor)" <humin29@huawei.com>
Date: Tue, 11 May 2021 15:25:30 +0200
Message-ID: <1821297.yTpHVI7bYs@thomas>
In-Reply-To: <d1dcb8b1-9fd2-a779-cf93-aeadae3d7c48@huawei.com>
References: <1619355594-15223-1-git-send-email-humin29@huawei.com>
 <BYAPR11MB3366369256169932CF7C2095FF409@BYAPR11MB3366.namprd11.prod.outlook.com>
 <d1dcb8b1-9fd2-a779-cf93-aeadae3d7c48@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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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 <dev-bounces@dpdk.org> 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;
> >>
> > <snip>
> >=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 <reshma.pattan@intel.com>