[dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check
Pattan, Reshma
reshma.pattan at intel.com
Wed Apr 28 17:13:55 CEST 2021
> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Min Hu (Connor)
>
> + if (lcore_id >= 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;
> + }
> +
This looks good.
> fds.fd = global_fds[lcore_id];
> fds.events = POLLIN;
>
<snip>
> if (global_fds[lcore_id] < 0) {
> RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not
> connected\n");
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 = global_fds[lcore_id]; "
Reviewed-by: Reshma Pattan <reshma.pattan at intel.com>
More information about the dev
mailing list