[PATCH] net/txgbe: fix a bit with boolean operator

Jiawen Wu jiawenwu at trustnetic.com
Wed Mar 2 09:02:43 CET 2022


On March 1, 2022 2:09 PM, Weiguo Li wrote:
> Since boolean value is in 0 and 1, it's strange to combines a boolean
value with
> a bit operator.
> 
> Thus it's highly possible a typo error with "if (A & !B)", and more
probably to
> use "if (A & ~B)" instead.
> 
> Fixes: c1d4e9d37abdc6 ("net/txgbe: add queue stats mapping")
> 
> Signed-off-by: Weiguo Li <liwg06 at foxmail.com>
> ---
>  drivers/net/txgbe/txgbe_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/txgbe/txgbe_ethdev.c
> b/drivers/net/txgbe/txgbe_ethdev.c
> index 19d4444748..f0994f028d 100644
> --- a/drivers/net/txgbe/txgbe_ethdev.c
> +++ b/drivers/net/txgbe/txgbe_ethdev.c
> @@ -376,7 +376,7 @@ txgbe_dev_queue_stats_mapping_set(struct
> rte_eth_dev *eth_dev,
>  	if (hw->mac.type != txgbe_mac_raptor)
>  		return -ENOSYS;
> 
> -	if (stat_idx & !QMAP_FIELD_RESERVED_BITS_MASK)
> +	if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK)
>  		return -EIO;
> 
>  	PMD_INIT_LOG(DEBUG, "Setting port %d, %s queue_id %d to stat
> index %d",
> --
> 2.25.1

Thanks.

Acked-by: Jiawen Wu <jiawenwu at trustnetic.com>





More information about the dev mailing list