net/ena: remove useless address check

Message ID 20211004172702.3461360-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/ena: remove useless address check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Ferruh Yigit Oct. 4, 2021, 5:27 p.m. UTC
  Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":

./drivers/net/ena/ena_rss.c: In function ‘ena_rss_reta_query’:
./drivers/net/ena/ena_rss.c:140:66:
	error: the comparison will always evaluate as ‘false’ for the
	pointer operand in ‘reta_conf + 136’ must not be NULL
	[-Werror=address]
  140 |  (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
      |                                                       ^~

Fixing it by removing useless check.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Not clear about the intention of the check, removing it in this patch to
trigger the discussion.
---
 drivers/net/ena/ena_rss.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Michal Krawczyk Oct. 11, 2021, 6:49 a.m. UTC | #1
pon., 4 paź 2021 o 19:27 Ferruh Yigit <ferruh.yigit@intel.com> napisał(a):
>
> Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":
>
> ./drivers/net/ena/ena_rss.c: In function ‘ena_rss_reta_query’:
> ./drivers/net/ena/ena_rss.c:140:66:
>         error: the comparison will always evaluate as ‘false’ for the
>         pointer operand in ‘reta_conf + 136’ must not be NULL
>         [-Werror=address]
>   140 |  (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
>       |                                                       ^~
>
> Fixing it by removing useless check.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>

> ---
> Not clear about the intention of the check, removing it in this patch to
> trigger the discussion.

It looks like this condition was unneeded from the beginning and is in
general invalid and comes from some misunderstanding. I'm ok with
removing this as it was dead code anyway.

> ---
>  drivers/net/ena/ena_rss.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
> index 88afe13da04d..152098410fa2 100644
> --- a/drivers/net/ena/ena_rss.c
> +++ b/drivers/net/ena/ena_rss.c
> @@ -136,8 +136,7 @@ int ena_rss_reta_query(struct rte_eth_dev *dev,
>         int reta_conf_idx;
>         int reta_idx;
>
> -       if (reta_size == 0 || reta_conf == NULL ||
> -           (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
> +       if (reta_size == 0 || reta_conf == NULL)
>                 return -EINVAL;
>
>         if (!(dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_RSS_HASH)) {
> --
> 2.31.1
>
  
Ferruh Yigit Oct. 11, 2021, 3:49 p.m. UTC | #2
On 10/11/2021 7:49 AM, Michał Krawczyk wrote:
> pon., 4 paź 2021 o 19:27 Ferruh Yigit <ferruh.yigit@intel.com> napisał(a):
>>
>> Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":
>>
>> ./drivers/net/ena/ena_rss.c: In function ‘ena_rss_reta_query’:
>> ./drivers/net/ena/ena_rss.c:140:66:
>>          error: the comparison will always evaluate as ‘false’ for the
>>          pointer operand in ‘reta_conf + 136’ must not be NULL
>>          [-Werror=address]
>>    140 |  (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
>>        |                                                       ^~
>>
>> Fixing it by removing useless check.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Acked-by: Michal Krawczyk <mk@semihalf.com>
> 

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c
index 88afe13da04d..152098410fa2 100644
--- a/drivers/net/ena/ena_rss.c
+++ b/drivers/net/ena/ena_rss.c
@@ -136,8 +136,7 @@  int ena_rss_reta_query(struct rte_eth_dev *dev,
 	int reta_conf_idx;
 	int reta_idx;
 
-	if (reta_size == 0 || reta_conf == NULL ||
-	    (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
+	if (reta_size == 0 || reta_conf == NULL)
 		return -EINVAL;
 
 	if (!(dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_RSS_HASH)) {