[11/19] fm10k: reduce scope of the ring variable
diff mbox series

Message ID 20190708231236.20516-12-jacob.e.keller@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show
Series
  • cleanup cppcheck warnings for fm10k driver
Related show

Commit Message

Keller, Jacob E July 8, 2019, 11:12 p.m. UTC
Reduce the scope of the ring local variable in the fm10k_assign_l2_accel
function.

This was detected by cppcheck and resolves the following warning
produced by that tool:

[fm10k_netdev.c:1447]: (style) The scope of the variable 'ring' can be
reduced.

Change-Id: Ia2f2bc0cabed02c65f513e9917bc1859d5cc414c
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Title: fm10k: reduce scope of the ring variable
Change-type: ImplementationChange
---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bowers, AndrewX July 12, 2019, 6:04 p.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:12 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring
> variable
> 
> Reduce the scope of the ring local variable in the fm10k_assign_l2_accel
> function.
> 
> This was detected by cppcheck and resolves the following warning produced
> by that tool:
> 
> [fm10k_netdev.c:1447]: (style) The scope of the variable 'ring' can be
> reduced.
> 
> Change-Id: Ia2f2bc0cabed02c65f513e9917bc1859d5cc414c
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Title: fm10k: reduce scope of the ring variable
> Change-type: ImplementationChange
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>

Patch
diff mbox series

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index c73fb38be678..259da075093f 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1444,11 +1444,11 @@  static int __fm10k_setup_tc(struct net_device *dev, enum tc_setup_type type,
 static void fm10k_assign_l2_accel(struct fm10k_intfc *interface,
 				  struct fm10k_l2_accel *l2_accel)
 {
-	struct fm10k_ring *ring;
 	int i;
 
 	for (i = 0; i < interface->num_rx_queues; i++) {
-		ring = interface->rx_ring[i];
+		struct fm10k_ring *ring = interface->rx_ring[i];
+
 		rcu_assign_pointer(ring->l2_accel, l2_accel);
 	}