[v21.02,v3,06/10] net/bonding: remove local variable shadowing outer one

Message ID 20201119115900.4095566-7-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series cppcheck |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Nov. 19, 2020, 11:58 a.m. UTC
  'retval' is already defined in the function scope, removing the 'retval'
in the block scope.

Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: tomaszx.kulasek@intel.com
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

David Marchand Jan. 8, 2021, 10:34 a.m. UTC | #1
On Thu, Nov 19, 2020 at 1:01 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> 'retval' is already defined in the function scope, removing the 'retval'
> in the block scope.
>
> Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
humin (Q) Jan. 11, 2021, 1:03 a.m. UTC | #2
Acked-by: Min Hu (Connor) <humin29@huawei.com>

在 2020/11/19 19:58, Ferruh Yigit 写道:
> 'retval' is already defined in the function scope, removing the 'retval'
> in the block scope.
> 
> Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: tomaszx.kulasek@intel.com
> ---
>   drivers/net/bonding/rte_eth_bond_8023ad.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index 67ca0730fa..5fe004e551 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -1334,8 +1334,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
>   		rte_eth_macaddr_get(slave_id, &m_hdr->eth_hdr.s_addr);
>   
>   		if (internals->mode4.dedicated_queues.enabled == 0) {
> -			int retval = rte_ring_enqueue(port->tx_ring, pkt);
> -			if (retval != 0) {
> +			if (rte_ring_enqueue(port->tx_ring, pkt) != 0) {
>   				/* reset timer */
>   				port->rx_marker_timer = 0;
>   				wrn = WRN_TX_QUEUE_FULL;
> @@ -1355,8 +1354,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
>   		}
>   	} else if (likely(subtype == SLOW_SUBTYPE_LACP)) {
>   		if (internals->mode4.dedicated_queues.enabled == 0) {
> -			int retval = rte_ring_enqueue(port->rx_ring, pkt);
> -			if (retval != 0) {
> +			if (rte_ring_enqueue(port->rx_ring, pkt) != 0) {
>   				/* If RX fing full free lacpdu message and drop packet */
>   				wrn = WRN_RX_QUEUE_FULL;
>   				goto free_out;
>
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 67ca0730fa..5fe004e551 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1334,8 +1334,7 @@  bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
 		rte_eth_macaddr_get(slave_id, &m_hdr->eth_hdr.s_addr);
 
 		if (internals->mode4.dedicated_queues.enabled == 0) {
-			int retval = rte_ring_enqueue(port->tx_ring, pkt);
-			if (retval != 0) {
+			if (rte_ring_enqueue(port->tx_ring, pkt) != 0) {
 				/* reset timer */
 				port->rx_marker_timer = 0;
 				wrn = WRN_TX_QUEUE_FULL;
@@ -1355,8 +1354,7 @@  bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals,
 		}
 	} else if (likely(subtype == SLOW_SUBTYPE_LACP)) {
 		if (internals->mode4.dedicated_queues.enabled == 0) {
-			int retval = rte_ring_enqueue(port->rx_ring, pkt);
-			if (retval != 0) {
+			if (rte_ring_enqueue(port->rx_ring, pkt) != 0) {
 				/* If RX fing full free lacpdu message and drop packet */
 				wrn = WRN_RX_QUEUE_FULL;
 				goto free_out;