octeontx2-pf: Remove repeating variable in test

Message ID Y+djy4R7Z/e5noRX@ubun2204.myguest.virtualbox.org
State New
Headers
Series octeontx2-pf: Remove repeating variable in test |

Commit Message

Deepak R Varma Feb. 11, 2023, 9:45 a.m. UTC
  No need to & a variable with itself. Remove extra variable from the
expression. Change allows to realign code and improve readability.
Issue identified using doublebitand.cocci Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Subbaraya Sundeep Feb. 13, 2023, 4:55 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Deepak R Varma <drv@mailo.com>
> Sent: Saturday, February 11, 2023 3:16 PM
> To: Sunil Kovvuri Goutham <sgoutham@marvell.com>; Geethasowjanya Akula
> <gakula@marvell.com>; Subbaraya Sundeep Bhatta <sbhatta@marvell.com>;
> Hariprasad Kelam <hkelam@marvell.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Saurabh Singh Sengar <ssengar@microsoft.com>; Praveen Kumar
> <kumarpraveen@linux.microsoft.com>; Deepak R Varma <drv@mailo.com>
> Subject: [EXT] [PATCH] octeontx2-pf: Remove repeating variable in test
> 
> External Email
> 
> ----------------------------------------------------------------------
> No need to & a variable with itself. Remove extra variable from the expression.
> Change allows to realign code and improve readability.
> Issue identified using doublebitand.cocci Coccinelle semantic patch.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> index 684cb8ec9f21..66a27ee5ca56 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> @@ -792,8 +792,7 @@ static int otx2_prepare_ipv6_flow(struct
> ethtool_rx_flow_spec *fsp,
>  		}
> 
>  		/* NPC profile doesn't extract AH/ESP header fields */
> -		if ((ah_esp_mask->spi & ah_esp_hdr->spi) ||
> -		    (ah_esp_mask->tclass & ah_esp_mask->tclass))
> +		if ((ah_esp_mask->spi & ah_esp_hdr->spi) || ah_esp_mask-
> >tclass)

It is a typo. Below is the correct one:
                           if ((ah_esp_mask->spi & ah_esp_hdr->spi) ||
		   (ah_esp_mask->tclass & ah_esp_hdr->tclass))

Thanks,
Sundeep

>  			return -EOPNOTSUPP;
> 
>  		if (flow_type == AH_V6_FLOW)
> --
> 2.34.1
> 
>
  

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
index 684cb8ec9f21..66a27ee5ca56 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
@@ -792,8 +792,7 @@  static int otx2_prepare_ipv6_flow(struct ethtool_rx_flow_spec *fsp,
 		}
 
 		/* NPC profile doesn't extract AH/ESP header fields */
-		if ((ah_esp_mask->spi & ah_esp_hdr->spi) ||
-		    (ah_esp_mask->tclass & ah_esp_mask->tclass))
+		if ((ah_esp_mask->spi & ah_esp_hdr->spi) || ah_esp_mask->tclass)
 			return -EOPNOTSUPP;
 
 		if (flow_type == AH_V6_FLOW)