All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver
@ 2019-07-08 23:12 Jacob Keller
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable Jacob Keller
                   ` (18 more replies)
  0 siblings, 19 replies; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

This series contains several patches which resolve various warnings
generated by using the cppcheck tool on the fm10k driver source code.

The most comment fix is to reduce the scope of local variables where
possible, and the first 10 patches fix issues like this.

The remaining 9 patches fix other issues found by the tool. Only one of the
patches contains what is likely a bug fix. Specifically, the last patch in
the series fixes a 64-bit register read issue where we failed to bitwise or
the high and low registers together. As this is only in the reporting flow
for fault detection, it is relatively minor.

This series does not fix all of the cppcheck warnings:

[fm10k_ethtool.c:332]: (style) Argument 'idx!=29' to function BUG_ON is always 0

This warning is due to the fact that we can't use BUILD_BUG_ON. cppcheck is
smart enough to realize that the index will always be 29, and thus that
BUG_ON will never be triggered.

[fm10k_mbx.c:335] -> [fm10k_mbx.c:356]: (style) Variable 'head' is reassigned a value before the old one has been used.
[fm10k_mbx.c:350] -> [fm10k_mbx.c:356]: (style) Variable 'head' is reassigned a value before the old one has been used.
[fm10k_mbx.c:428] -> [fm10k_mbx.c:442]: (style) Variable 'tail' is reassigned a value before the old one has been used.
[fm10k_mbx.c:439] -> [fm10k_mbx.c:442]: (style) Variable 'tail' is reassigned a value before the old one has been used.

These are almost certainly due to a bug in cppcheck analysis. The head and
tail values are assigned initially outside the loop. Then, they're updated
in the for loop. However, they aren't updated until the end of the *first*
for-loop iteration. I think cppcheck doesn't understand this and thus
assumes that the value will be overwritten before its first use.

Jacob Keller (19):
  fm10k: reduce scope of the err variable
  fm10k: reduce scope of *p local variable
  fm10k: reduce the scope of qv local variable
  fm10k: reduce the scope of local err variable
  fm10k: reduce the scope of the q_idx local variable
  fm10k: reduce the scope of the tx_buffer variable
  fm10k: reduce the scope of the err variable
  fm10k: reduce the scope of the local i variable
  fm10k: reduce the scope of the local msg variable
  fm10k: reduce the scope of the result local variable
  fm10k: reduce scope of the ring variable
  fm10k: remove unnecessary variable initializer
  fm10k: remove needless assignment of err local variable
  fm10k: remove needless initialization of size local variable
  fm10k: explicitly return 0 on success path in function
  fm10k: cast page_addr to u8 * when incrementing it
  fm10k: mark unused parameters with __always_unused
  fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS
  fm10k: fix fm10k_get_fault_pf to read correct address

 drivers/net/ethernet/intel/fm10k/fm10k.h      | 10 +++-----
 .../net/ethernet/intel/fm10k/fm10k_dcbnl.c    |  6 ++---
 .../net/ethernet/intel/fm10k/fm10k_ethtool.c  | 15 +++++------
 drivers/net/ethernet/intel/fm10k/fm10k_iov.c  |  5 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 15 +++++------
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c  | 11 +++++---
 .../net/ethernet/intel/fm10k/fm10k_netdev.c   | 20 +++++++--------
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c  | 20 +++++++--------
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c   | 15 ++++++-----
 drivers/net/ethernet/intel/fm10k/fm10k_tlv.c  |  9 ++++---
 drivers/net/ethernet/intel/fm10k/fm10k_type.h |  2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c   | 25 +++++++++++--------
 12 files changed, 78 insertions(+), 75 deletions(-)

-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 17:59   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 02/19] fm10k: reduce scope of *p local variable Jacob Keller
                   ` (17 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the err local variable in the fm10k_dcbnl_ieee_setets
function.

This was detected using cppcheck, and resolves the following style
warning:

[fm10k_dcbnl.c:37]: (style) The scope of the variable 'err' can be reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c b/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
index 20768ac7f17e..c45315472245 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k.h"
 
@@ -36,7 +36,7 @@ static int fm10k_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets)
 static int fm10k_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
 {
 	u8 num_tc = 0;
-	int i, err;
+	int i;
 
 	/* verify type and determine num_tcs needed */
 	for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
@@ -57,7 +57,7 @@ static int fm10k_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
 
 	/* update TC hardware mapping if necessary */
 	if (num_tc != netdev_get_num_tc(dev)) {
-		err = fm10k_setup_tc(dev, num_tc);
+		int err = fm10k_setup_tc(dev, num_tc);
 		if (err)
 			return err;
 	}
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 02/19] fm10k: reduce scope of *p local variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 17:59   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 03/19] fm10k: reduce the scope of qv " Jacob Keller
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the char *p local variable to only the block where
it is used.

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

[fm10k_ethtool.c:229]: (style) The scope of the variable 'p' can be
reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 4895dd83dd08..7b9440c0aee1 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include <linux/vmalloc.h>
 
@@ -222,7 +222,6 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer,
 				      const unsigned int size)
 {
 	unsigned int i;
-	char *p;
 
 	if (!pointer) {
 		/* memory is not zero allocated so we have to clear it */
@@ -232,7 +231,7 @@ static void __fm10k_add_ethtool_stats(u64 **data, void *pointer,
 	}
 
 	for (i = 0; i < size; i++) {
-		p = (char *)pointer + stats[i].stat_offset;
+		char *p = (char *)pointer + stats[i].stat_offset;
 
 		switch (stats[i].sizeof_stat) {
 		case sizeof(u64):
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 03/19] fm10k: reduce the scope of qv local variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable Jacob Keller
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 02/19] fm10k: reduce scope of *p local variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:00   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 04/19] fm10k: reduce the scope of local err variable Jacob Keller
                   ` (15 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the qv vector pointer local variable in the
fm10k_set_coalesce function.

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

[fm10k_ethtool.c:658]: (style) The scope of the variable 'qv' can be
reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 7b9440c0aee1..1f7e4a8f4557 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -650,7 +650,6 @@ static int fm10k_set_coalesce(struct net_device *dev,
 			      struct ethtool_coalesce *ec)
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
-	struct fm10k_q_vector *qv;
 	u16 tx_itr, rx_itr;
 	int i;
 
@@ -676,7 +675,8 @@ static int fm10k_set_coalesce(struct net_device *dev,
 
 	/* update q_vectors */
 	for (i = 0; i < interface->num_q_vectors; i++) {
-		qv = interface->q_vector[i];
+		struct fm10k_q_vector *qv = interface->q_vector[i];
+
 		qv->tx.itr = tx_itr;
 		qv->rx.itr = rx_itr;
 	}
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 04/19] fm10k: reduce the scope of local err variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (2 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 03/19] fm10k: reduce the scope of qv " Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:00   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 05/19] fm10k: reduce the scope of the q_idx local variable Jacob Keller
                   ` (14 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the local err variable in the fm10k_iov_alloc_data
function.

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

[fm10k_iov.c:426]: (style) The scope of the variable 'err' can be reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
index 8de77155f2e7..afe1fafd2447 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k.h"
 #include "fm10k_vf.h"
@@ -426,7 +426,7 @@ static s32 fm10k_iov_alloc_data(struct pci_dev *pdev, int num_vfs)
 	struct fm10k_iov_data *iov_data = interface->iov_data;
 	struct fm10k_hw *hw = &interface->hw;
 	size_t size;
-	int i, err;
+	int i;
 
 	/* return error if iov_data is already populated */
 	if (iov_data)
@@ -452,6 +452,7 @@ static s32 fm10k_iov_alloc_data(struct pci_dev *pdev, int num_vfs)
 	/* loop through vf_info structures initializing each entry */
 	for (i = 0; i < num_vfs; i++) {
 		struct fm10k_vf_info *vf_info = &iov_data->vf_info[i];
+		int err;
 
 		/* Record VF VSI value */
 		vf_info->vsi = i + 1;
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 05/19] fm10k: reduce the scope of the q_idx local variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (3 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 04/19] fm10k: reduce the scope of local err variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:01   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 06/19] fm10k: reduce the scope of the tx_buffer variable Jacob Keller
                   ` (13 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the q_idx local variable in the fm10k_cache_ring_qos
function.

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

[fm10k_main.c:2016]: (style) The scope of the variable 'q_idx' can be
reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index 90270b4a1682..3bacf35fbfad 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include <linux/types.h>
 #include <linux/module.h>
@@ -17,7 +17,7 @@ const char fm10k_driver_version[] = DRV_VERSION;
 char fm10k_driver_name[] = "fm10k";
 static const char fm10k_driver_string[] = DRV_SUMMARY;
 static const char fm10k_copyright[] =
-	"Copyright(c) 2013 - 2018 Intel Corporation.";
+	"Copyright(c) 2013 - 2019 Intel Corporation.";
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION(DRV_SUMMARY);
@@ -1869,7 +1869,7 @@ static int fm10k_init_msix_capability(struct fm10k_intfc *interface)
 static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface)
 {
 	struct net_device *dev = interface->netdev;
-	int pc, offset, rss_i, i, q_idx;
+	int pc, offset, rss_i, i;
 	u16 pc_stride = interface->ring_feature[RING_F_QOS].mask + 1;
 	u8 num_pcs = netdev_get_num_tc(dev);
 
@@ -1879,7 +1879,8 @@ static bool fm10k_cache_ring_qos(struct fm10k_intfc *interface)
 	rss_i = interface->ring_feature[RING_F_RSS].indices;
 
 	for (pc = 0, offset = 0; pc < num_pcs; pc++, offset += rss_i) {
-		q_idx = pc;
+		int q_idx = pc;
+
 		for (i = 0; i < rss_i; i++) {
 			interface->tx_ring[offset + i]->reg_idx = q_idx;
 			interface->tx_ring[offset + i]->qos_pc = pc;
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 06/19] fm10k: reduce the scope of the tx_buffer variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (4 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 05/19] fm10k: reduce the scope of the q_idx local variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:02   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 07/19] fm10k: reduce the scope of the err variable Jacob Keller
                   ` (12 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The tx_buffer local variable in the function fm10k_clean_tx_ring is not
used except inside a smaller block scope. Reduce the scope to its point
of use.

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

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

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 538a8467f434..c73fb38be678 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -169,7 +169,6 @@ void fm10k_unmap_and_free_tx_resource(struct fm10k_ring *ring,
  **/
 static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring)
 {
-	struct fm10k_tx_buffer *tx_buffer;
 	unsigned long size;
 	u16 i;
 
@@ -179,7 +178,8 @@ static void fm10k_clean_tx_ring(struct fm10k_ring *tx_ring)
 
 	/* Free all the Tx ring sk_buffs */
 	for (i = 0; i < tx_ring->count; i++) {
-		tx_buffer = &tx_ring->tx_buffer[i];
+		struct fm10k_tx_buffer *tx_buffer = &tx_ring->tx_buffer[i];
+
 		fm10k_unmap_and_free_tx_resource(tx_ring, tx_buffer);
 	}
 
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 07/19] fm10k: reduce the scope of the err variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (5 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 06/19] fm10k: reduce the scope of the tx_buffer variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:02   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 08/19] fm10k: reduce the scope of the local i variable Jacob Keller
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the local variable err in the fm10k_detach_subtask
function.

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

[fm10k_pci.c:403]: (style) The scope of the variable 'err' can be reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index e49fb51d3613..8cdfb24125bf 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -344,7 +344,6 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface)
 	struct net_device *netdev = interface->netdev;
 	u32 __iomem *hw_addr;
 	u32 value;
-	int err;
 
 	/* do nothing if netdev is still present or hw_addr is set */
 	if (netif_device_present(netdev) || interface->hw.hw_addr)
@@ -362,6 +361,8 @@ static void fm10k_detach_subtask(struct fm10k_intfc *interface)
 	hw_addr = READ_ONCE(interface->uc_addr);
 	value = readl(hw_addr);
 	if (~value) {
+		int err;
+
 		/* Make sure the reset was initiated because we detached,
 		 * otherwise we might race with a different reset flow.
 		 */
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 08/19] fm10k: reduce the scope of the local i variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (6 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 07/19] fm10k: reduce the scope of the err variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:02   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 09/19] fm10k: reduce the scope of the local msg variable Jacob Keller
                   ` (10 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the local loop variable in the
fm10k_check_hang_subtask function.

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

[driver/fm10k_pci.c:852]: (style) The scope of the variable 'i' can be
reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 8cdfb24125bf..10a3b2576a3c 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -698,8 +698,6 @@ static void fm10k_watchdog_subtask(struct fm10k_intfc *interface)
  */
 static void fm10k_check_hang_subtask(struct fm10k_intfc *interface)
 {
-	int i;
-
 	/* If we're down or resetting, just bail */
 	if (test_bit(__FM10K_DOWN, interface->state) ||
 	    test_bit(__FM10K_RESETTING, interface->state))
@@ -711,6 +709,8 @@ static void fm10k_check_hang_subtask(struct fm10k_intfc *interface)
 	interface->next_tx_hang_check = jiffies + (2 * HZ);
 
 	if (netif_carrier_ok(interface->netdev)) {
+		int i;
+
 		/* Force detection of hung controller */
 		for (i = 0; i < interface->num_tx_queues; i++)
 			set_check_for_tx_hang(interface->tx_ring[i]);
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 09/19] fm10k: reduce the scope of the local msg variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (7 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 08/19] fm10k: reduce the scope of the local i variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:03   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 10/19] fm10k: reduce the scope of the result local variable Jacob Keller
                   ` (9 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The msg variable in the fm10k_mbx_validate_msg_size and
fm10k_sm_mbx_transmit functions is only used within the do {} loop
scope. Reduce its scope only to where it is used.

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

[fm10k_mbx.c:299]: (style) The scope of the variable 'msg' can be reduced.
[fm10k_mbx.c:2004]: (style) The scope of the variable 'msg' can be reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index 21021fe4f1c3..aece335b41f8 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -297,13 +297,14 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 {
 	struct fm10k_mbx_fifo *fifo = &mbx->rx;
 	u16 total_len = 0, msg_len;
-	u32 *msg;
 
 	/* length should include previous amounts pushed */
 	len += mbx->pushed;
 
 	/* offset in message is based off of current message size */
 	do {
+		u32 *msg;
+
 		msg = fifo->buffer + fm10k_fifo_tail_offset(fifo, total_len);
 		msg_len = FM10K_TLV_DWORD_LEN(*msg);
 		total_len += msg_len;
@@ -1920,7 +1921,6 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
 	/* reduce length by 1 to convert to a mask */
 	u16 mbmem_len = mbx->mbmem_len - 1;
 	u16 tail_len, len = 0;
-	u32 *msg;
 
 	/* push head behind tail */
 	if (mbx->tail < head)
@@ -1930,6 +1930,8 @@ static void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
 
 	/* determine msg aligned offset for end of buffer */
 	do {
+		u32 *msg;
+
 		msg = fifo->buffer + fm10k_fifo_head_offset(fifo, len);
 		tail_len = len;
 		len += FM10K_TLV_DWORD_LEN(*msg);
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 10/19] fm10k: reduce the scope of the result local variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (8 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 09/19] fm10k: reduce the scope of the local msg variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:04   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring variable Jacob Keller
                   ` (8 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Reduce the scope of the result local variable in the
fm10k_iov_msg_lport_state_pf function.

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

[fm10k_pf.c:1435]: (style) The scope of the variable 'result' can be
reduced.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index cb4d02629b86..e85b2f2eef05 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -1352,7 +1352,6 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 				 struct fm10k_mbx_info *mbx)
 {
 	struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
-	u32 *result;
 	s32 err = 0;
 	u32 msg[2];
 	u8 mode = 0;
@@ -1362,7 +1361,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 		return FM10K_ERR_PARAM;
 
 	if (!!results[FM10K_LPORT_STATE_MSG_XCAST_MODE]) {
-		result = results[FM10K_LPORT_STATE_MSG_XCAST_MODE];
+		u32 *result = results[FM10K_LPORT_STATE_MSG_XCAST_MODE];
 
 		/* XCAST mode update requested */
 		err = fm10k_tlv_attr_get_u8(result, &mode);
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (9 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 10/19] fm10k: reduce the scope of the result local variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:04   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 12/19] fm10k: remove unnecessary variable initializer Jacob Keller
                   ` (7 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

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(-)

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);
 	}
 
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 12/19] fm10k: remove unnecessary variable initializer
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (10 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:05   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless assignment of err local variable Jacob Keller
                   ` (6 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The err variable in the fm10k_tlv_attr_parse function is initialized
with zero. However, the function never reads err without first assigning
it from a function call. Remove this unnecessary initialization.

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

[fm10k_tlv.c:498]: (style) Variable 'err' is assigned a value that is
never used.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_tlv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
index 2a7a40bf2b1c..f4c42a40f934 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
@@ -472,7 +472,7 @@ static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
 				const struct fm10k_tlv_attr *tlv_attr)
 {
 	u32 i, attr_id, offset = 0;
-	s32 err = 0;
+	s32 err;
 	u16 len;
 
 	/* verify pointers are not NULL */
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless assignment of err local variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (11 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 12/19] fm10k: remove unnecessary variable initializer Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:05   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless initialization of size " Jacob Keller
                   ` (5 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The local variable err in several functions in the fm10k_netdev.c file
is initialized with a value that is never used. The err value is
immediately re-assigned in all cases where it will be checked. Remove
the unnecessary initializers.

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

[fm10k_netdev.c:999] -> [fm10k_netdev.c:1004]: (style) Variable 'err' is
reassigned a value before the old one has been used.

[fm10k_netdev.c:1019] -> [fm10k_netdev.c:1024]: (style) Variable 'err'
is reassigned a value before the old one has been used.

[fm10k_netdev.c:64]: (style) Variable 'err' is assigned a value that is
never used.

[fm10k_netdev.c:131]: (style) Variable 'err' is assigned a value that
is never used.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 259da075093f..4704395c0f66 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k.h"
 #include <linux/vmalloc.h>
@@ -54,7 +54,7 @@ int fm10k_setup_tx_resources(struct fm10k_ring *tx_ring)
  **/
 static int fm10k_setup_all_tx_resources(struct fm10k_intfc *interface)
 {
-	int i, err = 0;
+	int i, err;
 
 	for (i = 0; i < interface->num_tx_queues; i++) {
 		err = fm10k_setup_tx_resources(interface->tx_ring[i]);
@@ -121,7 +121,7 @@ int fm10k_setup_rx_resources(struct fm10k_ring *rx_ring)
  **/
 static int fm10k_setup_all_rx_resources(struct fm10k_intfc *interface)
 {
-	int i, err = 0;
+	int i, err;
 
 	for (i = 0; i < interface->num_rx_queues; i++) {
 		err = fm10k_setup_rx_resources(interface->rx_ring[i]);
@@ -871,7 +871,7 @@ static int fm10k_uc_vlan_unsync(struct net_device *netdev,
 	u16 glort = interface->glort;
 	u16 vid = interface->vid;
 	bool set = !!(vid / VLAN_N_VID);
-	int err = -EHOSTDOWN;
+	int err;
 
 	/* drop any leading bits on the VLAN ID */
 	vid &= VLAN_N_VID - 1;
@@ -891,7 +891,7 @@ static int fm10k_mc_vlan_unsync(struct net_device *netdev,
 	u16 glort = interface->glort;
 	u16 vid = interface->vid;
 	bool set = !!(vid / VLAN_N_VID);
-	int err = -EHOSTDOWN;
+	int err;
 
 	/* drop any leading bits on the VLAN ID */
 	vid &= VLAN_N_VID - 1;
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless initialization of size local variable
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (12 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless assignment of err local variable Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:06   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success path in function Jacob Keller
                   ` (4 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The local variable 'size' in fm10k_dfwd_add_station is initialized, but
is always re-assigned immediately before use. Remove this unnecessary
initialization.

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

[fm10k_netdev.c:1466]: (style) Variable 'size' is assigned a value that is never used.

Change-Id: I6f6d1ba3b9b26c2ed6f434fbeeafbbda4b78db33
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Title: fm10k: remove needless initialization of size local variable
Change-type: ImplementationChange
---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 4704395c0f66..d3e85480f46d 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1463,7 +1463,7 @@ static void *fm10k_dfwd_add_station(struct net_device *dev,
 	struct fm10k_l2_accel *old_l2_accel = NULL;
 	struct fm10k_dglort_cfg dglort = { 0 };
 	struct fm10k_hw *hw = &interface->hw;
-	int size = 0, i;
+	int size, i;
 	u16 vid, glort;
 
 	/* The hardware supported by fm10k only filters on the destination MAC
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success path in function
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (13 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless initialization of size " Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:06   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when incrementing it Jacob Keller
                   ` (3 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

In the fm10k_handle_resume function, return 0 explicitly at the end of
the function instead of returning the err value.

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

[fm10k_pci.c:2768] -> [fm10k_pci.c:2787]: (warning) Identical condition
'err', second condition is always false

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 10a3b2576a3c..082e68354643 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -2340,7 +2340,7 @@ static int fm10k_handle_resume(struct fm10k_intfc *interface)
 	/* Restart the MAC/VLAN request queue in-case of outstanding events */
 	fm10k_macvlan_schedule(interface);
 
-	return err;
+	return 0;
 }
 
 /**
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when incrementing it
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (14 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success path in function Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:07   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters with __always_unused Jacob Keller
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The page_addr variable is a void pointer. Incrementing it before calling
prefetch is technically undefined. Fix this by casting it to a u8*
pointer before incrementing it. This ensures that we increment the
pointer value in byte units, instead of relying on this undefined
behavior.

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

[fm10k_main.c:328]: (portability) 'page_addr' is of type 'void *'. When
using void pointers in calculations, the behaviour is undefined.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index 3bacf35fbfad..cf87812bdf4a 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -315,7 +315,7 @@ static struct sk_buff *fm10k_fetch_rx_buffer(struct fm10k_ring *rx_ring,
 		/* prefetch first cache line of first page */
 		prefetch(page_addr);
 #if L1_CACHE_BYTES < 128
-		prefetch(page_addr + L1_CACHE_BYTES);
+		prefetch((void *)((u8 *)page_addr + L1_CACHE_BYTES));
 #endif
 
 		/* allocate a skb to store the frags */
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters with __always_unused
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (15 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when incrementing it Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:07   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 18/19] fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS Jacob Keller
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to read correct address Jacob Keller
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Several functions in the fm10k driver have specific function templates,
as they are used as function pointers. The parameters in these functions
are not always used. Explicitly mark unused parameters with the
__always_unused macro, so that the compiler will not warn about them
when building with the -Wunused-parameter warning enabled.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c  |  5 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c   | 10 ++++----
 drivers/net/ethernet/intel/fm10k/fm10k_tlv.c  |  7 +++---
 drivers/net/ethernet/intel/fm10k/fm10k_type.h |  2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c   | 25 +++++++++++--------
 5 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index aece335b41f8..75e51f91036c 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k_common.h"
 
@@ -2134,7 +2134,8 @@ static s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
  *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
  *  error.
  **/
-s32 fm10k_sm_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
+s32 fm10k_sm_mbx_init(struct fm10k_hw __always_unused *hw,
+		      struct fm10k_mbx_info *mbx,
 		      const struct fm10k_msg_data *msg_data)
 {
 	mbx->mbx_reg = FM10K_GMBX;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index e85b2f2eef05..095c5b0e4096 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k_pf.h"
 #include "fm10k_vf.h"
@@ -1152,7 +1152,7 @@ static void fm10k_iov_update_stats_pf(struct fm10k_hw *hw,
  *  assumption is that in this case it is acceptable to just directly
  *  hand off the message from the VF to the underlying shared code.
  **/
-s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,
+s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 __always_unused **results,
 			  struct fm10k_mbx_info *mbx)
 {
 	struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
@@ -1641,7 +1641,7 @@ const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[] = {
  *  switch API.
  **/
 s32 fm10k_msg_lport_map_pf(struct fm10k_hw *hw, u32 **results,
-			   struct fm10k_mbx_info *mbx)
+			   struct fm10k_mbx_info __always_unused *mbx)
 {
 	u16 glort, mask;
 	u32 dglort_map;
@@ -1684,7 +1684,7 @@ const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[] = {
  *  This handler configures the default VLAN for the PF
  **/
 static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
-				    struct fm10k_mbx_info *mbx)
+				    struct fm10k_mbx_info __always_unused *mbx)
 {
 	u16 glort, pvid;
 	u32 pvid_update;
@@ -1745,7 +1745,7 @@ const struct fm10k_tlv_attr fm10k_err_msg_attr[] = {
  *  messages that the PF has sent.
  **/
 s32 fm10k_msg_err_pf(struct fm10k_hw *hw, u32 **results,
-		     struct fm10k_mbx_info *mbx)
+		     struct fm10k_mbx_info __always_unused *mbx)
 {
 	struct fm10k_swapi_error err_msg;
 	s32 err;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
index f4c42a40f934..21eff0895a7a 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k_tlv.h"
 
@@ -587,8 +587,9 @@ s32 fm10k_tlv_msg_parse(struct fm10k_hw *hw, u32 *msg,
  *  a minimum it just indicates that the message requested was
  *  unimplemented.
  **/
-s32 fm10k_tlv_msg_error(struct fm10k_hw *hw, u32 **results,
-			struct fm10k_mbx_info *mbx)
+s32 fm10k_tlv_msg_error(struct fm10k_hw __always_unused *hw,
+			u32 __always_unused **results,
+			struct fm10k_mbx_info __always_unused *mbx)
 {
 	return FM10K_NOT_IMPLEMENTED;
 }
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_type.h b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
index 9fb9fca375e3..15ac1c7885bc 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_type.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #ifndef _FM10K_TYPE_H_
 #define _FM10K_TYPE_H_
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
index a8519c1f0406..dc8ccd378ec9 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #include "fm10k_vf.h"
 
@@ -198,7 +198,7 @@ static s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
  *  This function should determine the MAC address for the VF
  **/
 s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results,
-			  struct fm10k_mbx_info *mbx)
+			  struct fm10k_mbx_info __always_unused *mbx)
 {
 	u8 perm_addr[ETH_ALEN];
 	u16 vid;
@@ -267,8 +267,10 @@ static s32 fm10k_read_mac_addr_vf(struct fm10k_hw *hw)
  *  This function is used to add or remove unicast MAC addresses for
  *  the VF.
  **/
-static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,
-				   const u8 *mac, u16 vid, bool add, u8 flags)
+static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw,
+				   u16 __always_unused glort,
+				   const u8 *mac, u16 vid, bool add,
+				   u8 __always_unused flags)
 {
 	struct fm10k_mbx_info *mbx = &hw->mbx;
 	u32 msg[7];
@@ -309,7 +311,8 @@ static s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,
  *  This function is used to add or remove multicast MAC addresses for
  *  the VF.
  **/
-static s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, u16 glort,
+static s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw,
+				   u16 __always_unused glort,
 				   const u8 *mac, u16 vid, bool add)
 {
 	struct fm10k_mbx_info *mbx = &hw->mbx;
@@ -373,7 +376,7 @@ const struct fm10k_tlv_attr fm10k_lport_state_msg_attr[] = {
  *  are ready to bring up the interface.
  **/
 s32 fm10k_msg_lport_state_vf(struct fm10k_hw *hw, u32 **results,
-			     struct fm10k_mbx_info *mbx)
+			     struct fm10k_mbx_info __always_unused *mbx)
 {
 	hw->mac.dglort_map = !results[FM10K_LPORT_STATE_MSG_READY] ?
 			     FM10K_DGLORTMAP_NONE : FM10K_DGLORTMAP_ZERO;
@@ -392,8 +395,9 @@ s32 fm10k_msg_lport_state_vf(struct fm10k_hw *hw, u32 **results,
  *  enabled we can add filters, if it is disabled all filters for this
  *  logical port are flushed.
  **/
-static s32 fm10k_update_lport_state_vf(struct fm10k_hw *hw, u16 glort,
-				       u16 count, bool enable)
+static s32 fm10k_update_lport_state_vf(struct fm10k_hw *hw,
+				       u16 __always_unused glort,
+				       u16 __always_unused count, bool enable)
 {
 	struct fm10k_mbx_info *mbx = &hw->mbx;
 	u32 msg[2];
@@ -420,7 +424,8 @@ static s32 fm10k_update_lport_state_vf(struct fm10k_hw *hw, u16 glort,
  *  so that it can enable either multicast, multicast promiscuous, or
  *  promiscuous mode of operation.
  **/
-static s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw, u16 glort, u8 mode)
+static s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw,
+				      u16 __always_unused glort, u8 mode)
 {
 	struct fm10k_mbx_info *mbx = &hw->mbx;
 	u32 msg[3];
@@ -475,7 +480,7 @@ static void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw,
  *  that information to then populate a DGLORTMAP/DEC entry and the queues
  *  to which it has been assigned.
  **/
-static s32 fm10k_configure_dglort_map_vf(struct fm10k_hw *hw,
+static s32 fm10k_configure_dglort_map_vf(struct fm10k_hw __always_unused *hw,
 					 struct fm10k_dglort_cfg *dglort)
 {
 	/* verify the dglort pointer */
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 18/19] fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (16 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters with __always_unused Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:08   ` Bowers, AndrewX
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to read correct address Jacob Keller
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

The driver currently uses a macro to decide whether we should use
NON_Q_VECTORS_PF or NON_Q_VECTORS_VF.

However, we also define NON_Q_VECTORS_VF to the same value as
NON_Q_VECTORS_PF. This means that the macro NON_Q_VECTORS(hw) will
always return the same value.

Let's just remove this macro, and replace it directly with an enum value
on the enum non_q_vectors.

This was detected by cppcheck and fixes the following warnings when
building with BUILD=KERNEL

[fm10k_ethtool.c:1123]: (style) Same value in both branches of ternary
operator.

[fm10k_ethtool.c:1142]: (style) Same value in both branches of ternary
operator.

[fm10k_main.c:1826]: (style) Same value in both branches of ternary
operator.

[fm10k_main.c:1849]: (style) Same value in both branches of ternary
operator.

[fm10k_main.c:1858]: (style) Same value in both branches of ternary
operator.

[fm10k_pci.c:901]: (style) Same value in both branches of ternary
operator.

[fm10k_pci.c:1040]: (style) Same value in both branches of ternary
operator.

[fm10k_pci.c:1726]: (style) Same value in both branches of ternary
operator.

[fm10k_pci.c:1763]: (style) Same value in both branches of ternary
operator.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k.h         | 10 +++-------
 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c |  6 ++----
 drivers/net/ethernet/intel/fm10k/fm10k_main.c    |  4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c     |  9 ++++-----
 4 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 7d42582ed48d..b14441944b4b 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright(c) 2013 - 2018 Intel Corporation. */
+/* Copyright(c) 2013 - 2019 Intel Corporation. */
 
 #ifndef _FM10K_H_
 #define _FM10K_H_
@@ -177,14 +177,10 @@ static inline struct netdev_queue *txring_txq(const struct fm10k_ring *ring)
 #define MIN_Q_VECTORS	1
 enum fm10k_non_q_vectors {
 	FM10K_MBX_VECTOR,
-#define NON_Q_VECTORS_VF NON_Q_VECTORS_PF
-	NON_Q_VECTORS_PF
+	NON_Q_VECTORS
 };
 
-#define NON_Q_VECTORS(hw)	(((hw)->mac.type == fm10k_mac_pf) ? \
-						NON_Q_VECTORS_PF : \
-						NON_Q_VECTORS_VF)
-#define MIN_MSIX_COUNT(hw)	(MIN_Q_VECTORS + NON_Q_VECTORS(hw))
+#define MIN_MSIX_COUNT(hw)	(MIN_Q_VECTORS + NON_Q_VECTORS)
 
 struct fm10k_q_vector {
 	struct fm10k_intfc *interface;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 1f7e4a8f4557..c681d2d28107 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -1114,13 +1114,12 @@ static void fm10k_get_channels(struct net_device *dev,
 			       struct ethtool_channels *ch)
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
-	struct fm10k_hw *hw = &interface->hw;
 
 	/* report maximum channels */
 	ch->max_combined = fm10k_max_channels(dev);
 
 	/* report info for other vector */
-	ch->max_other = NON_Q_VECTORS(hw);
+	ch->max_other = NON_Q_VECTORS;
 	ch->other_count = ch->max_other;
 
 	/* record RSS queues */
@@ -1132,14 +1131,13 @@ static int fm10k_set_channels(struct net_device *dev,
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
 	unsigned int count = ch->combined_count;
-	struct fm10k_hw *hw = &interface->hw;
 
 	/* verify they are not requesting separate vectors */
 	if (!count || ch->rx_count || ch->tx_count)
 		return -EINVAL;
 
 	/* verify other_count has not changed */
-	if (ch->other_count != NON_Q_VECTORS(hw))
+	if (ch->other_count != NON_Q_VECTORS)
 		return -EINVAL;
 
 	/* verify the number of channels does not exceed hardware limits */
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index cf87812bdf4a..701f83325c49 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1823,7 +1823,7 @@ static int fm10k_init_msix_capability(struct fm10k_intfc *interface)
 	v_budget = min_t(u16, v_budget, num_online_cpus());
 
 	/* account for vectors not related to queues */
-	v_budget += NON_Q_VECTORS(hw);
+	v_budget += NON_Q_VECTORS;
 
 	/* At the same time, hardware can only support a maximum of
 	 * hw.mac->max_msix_vectors vectors.  With features
@@ -1855,7 +1855,7 @@ static int fm10k_init_msix_capability(struct fm10k_intfc *interface)
 	}
 
 	/* record the number of queues available for q_vectors */
-	interface->num_q_vectors = v_budget - NON_Q_VECTORS(hw);
+	interface->num_q_vectors = v_budget - NON_Q_VECTORS;
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 082e68354643..1dfa9eaea368 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -898,7 +898,7 @@ static void fm10k_configure_tx_ring(struct fm10k_intfc *interface,
 
 	/* Map interrupt */
 	if (ring->q_vector) {
-		txint = ring->q_vector->v_idx + NON_Q_VECTORS(hw);
+		txint = ring->q_vector->v_idx + NON_Q_VECTORS;
 		txint |= FM10K_INT_MAP_TIMER0;
 	}
 
@@ -1037,7 +1037,7 @@ static void fm10k_configure_rx_ring(struct fm10k_intfc *interface,
 
 	/* Map interrupt */
 	if (ring->q_vector) {
-		rxint = ring->q_vector->v_idx + NON_Q_VECTORS(hw);
+		rxint = ring->q_vector->v_idx + NON_Q_VECTORS;
 		rxint |= FM10K_INT_MAP_TIMER1;
 	}
 
@@ -1720,10 +1720,9 @@ int fm10k_mbx_request_irq(struct fm10k_intfc *interface)
 void fm10k_qv_free_irq(struct fm10k_intfc *interface)
 {
 	int vector = interface->num_q_vectors;
-	struct fm10k_hw *hw = &interface->hw;
 	struct msix_entry *entry;
 
-	entry = &interface->msix_entries[NON_Q_VECTORS(hw) + vector];
+	entry = &interface->msix_entries[NON_Q_VECTORS + vector];
 
 	while (vector) {
 		struct fm10k_q_vector *q_vector;
@@ -1760,7 +1759,7 @@ int fm10k_qv_request_irq(struct fm10k_intfc *interface)
 	unsigned int ri = 0, ti = 0;
 	int vector, err;
 
-	entry = &interface->msix_entries[NON_Q_VECTORS(hw)];
+	entry = &interface->msix_entries[NON_Q_VECTORS];
 
 	for (vector = 0; vector < interface->num_q_vectors; vector++) {
 		struct fm10k_q_vector *q_vector = interface->q_vector[vector];
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to read correct address
  2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
                   ` (17 preceding siblings ...)
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 18/19] fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS Jacob Keller
@ 2019-07-08 23:12 ` Jacob Keller
  2019-07-12 18:08   ` Bowers, AndrewX
  18 siblings, 1 reply; 39+ messages in thread
From: Jacob Keller @ 2019-07-08 23:12 UTC (permalink / raw)
  To: intel-wired-lan

Fix assignment of the FM10K_FAULT_ADDR_LO register into fault->address
by using a bit-wise |= operation. Without this, the low address is
completely overwriting the high potion of the address. This caused the
fault to incorrectly return only the lower 32 bits of the fault address.

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

[fm10k_pf.c:1668] -> [fm10k_pf.c:1670]: (style) Variable
'fault->address' is reassigned a value before the old one has been used.

[fm10k_pf.c:1669] -> [fm10k_pf.c:1670]: (style) Variable
'fault->address' is reassigned a value before the old one has been used.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index 095c5b0e4096..be07bfdb0bb4 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -1565,7 +1565,7 @@ static s32 fm10k_get_fault_pf(struct fm10k_hw *hw, int type,
 	/* read remaining fields */
 	fault->address = fm10k_read_reg(hw, type + FM10K_FAULT_ADDR_HI);
 	fault->address <<= 32;
-	fault->address = fm10k_read_reg(hw, type + FM10K_FAULT_ADDR_LO);
+	fault->address |= fm10k_read_reg(hw, type + FM10K_FAULT_ADDR_LO);
 	fault->specinfo = fm10k_read_reg(hw, type + FM10K_FAULT_SPECINFO);
 
 	/* clear valid bit to allow for next error */
-- 
2.22.0.214.g8dca754b1e87


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable Jacob Keller
@ 2019-07-12 17:59   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 17:59 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 01/19] fm10k: reduce scope of the err
> variable
> 
> Reduce the scope of the err local variable in the fm10k_dcbnl_ieee_setets
> function.
> 
> This was detected using cppcheck, and resolves the following style
> warning:
> 
> [fm10k_dcbnl.c:37]: (style) The scope of the variable 'err' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

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




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 02/19] fm10k: reduce scope of *p local variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 02/19] fm10k: reduce scope of *p local variable Jacob Keller
@ 2019-07-12 17:59   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 17:59 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 02/19] fm10k: reduce scope of *p local
> variable
> 
> Reduce the scope of the char *p local variable to only the block where it is
> used.
> 
> This was detected by cppcheck and resolves the following style warning
> produced by that tool:
> 
> [fm10k_ethtool.c:229]: (style) The scope of the variable 'p' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 03/19] fm10k: reduce the scope of qv local variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 03/19] fm10k: reduce the scope of qv " Jacob Keller
@ 2019-07-12 18:00   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:00 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 03/19] fm10k: reduce the scope of qv local
> variable
> 
> Reduce the scope of the qv vector pointer local variable in the
> fm10k_set_coalesce function.
> 
> This was detected by cppcheck and resolves the following style warning
> produced by that tool:
> 
> [fm10k_ethtool.c:658]: (style) The scope of the variable 'qv' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 04/19] fm10k: reduce the scope of local err variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 04/19] fm10k: reduce the scope of local err variable Jacob Keller
@ 2019-07-12 18:00   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:00 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 04/19] fm10k: reduce the scope of local err
> variable
> 
> Reduce the scope of the local err variable in the fm10k_iov_alloc_data
> function.
> 
> This was detected by cppcheck and resolves the following style warning
> produced by that tool:
> 
> [fm10k_iov.c:426]: (style) The scope of the variable 'err' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 05/19] fm10k: reduce the scope of the q_idx local variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 05/19] fm10k: reduce the scope of the q_idx local variable Jacob Keller
@ 2019-07-12 18:01   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:01 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 05/19] fm10k: reduce the scope of the
> q_idx local variable
> 
> Reduce the scope of the q_idx local variable in the fm10k_cache_ring_qos
> function.
> 
> This was detected by cppcheck and resolves the following style warning
> produced by that tool:
> 
> [fm10k_main.c:2016]: (style) The scope of the variable 'q_idx' can be
> reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 06/19] fm10k: reduce the scope of the tx_buffer variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 06/19] fm10k: reduce the scope of the tx_buffer variable Jacob Keller
@ 2019-07-12 18:02   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:02 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 06/19] fm10k: reduce the scope of the
> tx_buffer variable
> 
> The tx_buffer local variable in the function fm10k_clean_tx_ring is not used
> except inside a smaller block scope. Reduce the scope to its point of use.
> 
> This was detected by cppcheck and resolves the following style warning
> produced by that tool:
> 
> [fm10k_netdev.c:179]: (style) The scope of the variable 'tx_buffer' can be
> reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 07/19] fm10k: reduce the scope of the err variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 07/19] fm10k: reduce the scope of the err variable Jacob Keller
@ 2019-07-12 18:02   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:02 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 07/19] fm10k: reduce the scope of the err
> variable
> 
> Reduce the scope of the local variable err in the fm10k_detach_subtask
> function.
> 
> This was detected by cppcheck and resolves the following warning produced
> by that tool:
> 
> [fm10k_pci.c:403]: (style) The scope of the variable 'err' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 08/19] fm10k: reduce the scope of the local i variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 08/19] fm10k: reduce the scope of the local i variable Jacob Keller
@ 2019-07-12 18:02   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:02 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 08/19] fm10k: reduce the scope of the local
> i variable
> 
> Reduce the scope of the local loop variable in the
> fm10k_check_hang_subtask function.
> 
> This was detected by cppcheck and resolves the following warning produced
> by that tool:
> 
> [driver/fm10k_pci.c:852]: (style) The scope of the variable 'i' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 09/19] fm10k: reduce the scope of the local msg variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 09/19] fm10k: reduce the scope of the local msg variable Jacob Keller
@ 2019-07-12 18:03   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:03 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 09/19] fm10k: reduce the scope of the local
> msg variable
> 
> The msg variable in the fm10k_mbx_validate_msg_size and
> fm10k_sm_mbx_transmit functions is only used within the do {} loop scope.
> Reduce its scope only to where it is used.
> 
> This was detected by cppcheck, and resolves the following warnings
> produced by that tool:
> 
> [fm10k_mbx.c:299]: (style) The scope of the variable 'msg' can be reduced.
> [fm10k_mbx.c:2004]: (style) The scope of the variable 'msg' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 10/19] fm10k: reduce the scope of the result local variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 10/19] fm10k: reduce the scope of the result local variable Jacob Keller
@ 2019-07-12 18:04   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:04 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 10/19] fm10k: reduce the scope of the
> result local variable
> 
> Reduce the scope of the result local variable in the
> fm10k_iov_msg_lport_state_pf function.
> 
> This was detected by cppcheck and resolves the following warning produced
> by that tool:
> 
> [fm10k_pf.c:1435]: (style) The scope of the variable 'result' can be reduced.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring variable Jacob Keller
@ 2019-07-12 18:04   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:04 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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>



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 12/19] fm10k: remove unnecessary variable initializer
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 12/19] fm10k: remove unnecessary variable initializer Jacob Keller
@ 2019-07-12 18:05   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:05 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at 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 12/19] fm10k: remove unnecessary
> variable initializer
> 
> The err variable in the fm10k_tlv_attr_parse function is initialized with zero.
> However, the function never reads err without first assigning it from a
> function call. Remove this unnecessary initialization.
> 
> This was detected by cppcheck and resolves the following warning produced
> by that tool:
> 
> [fm10k_tlv.c:498]: (style) Variable 'err' is assigned a value that is never used.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_tlv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless assignment of err local variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless assignment of err local variable Jacob Keller
@ 2019-07-12 18:05   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:05 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless
> assignment of err local variable
> 
> The local variable err in several functions in the fm10k_netdev.c file is
> initialized with a value that is never used. The err value is immediately re-
> assigned in all cases where it will be checked. Remove the unnecessary
> initializers.
> 
> This was detected by cppcheck and resolves the following warnings
> produced by that tool:
> 
> [fm10k_netdev.c:999] -> [fm10k_netdev.c:1004]: (style) Variable 'err' is
> reassigned a value before the old one has been used.
> 
> [fm10k_netdev.c:1019] -> [fm10k_netdev.c:1024]: (style) Variable 'err'
> is reassigned a value before the old one has been used.
> 
> [fm10k_netdev.c:64]: (style) Variable 'err' is assigned a value that is never
> used.
> 
> [fm10k_netdev.c:131]: (style) Variable 'err' is assigned a value that is never
> used.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless initialization of size local variable
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless initialization of size " Jacob Keller
@ 2019-07-12 18:06   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:06 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless
> initialization of size local variable
> 
> The local variable 'size' in fm10k_dfwd_add_station is initialized, but is always
> re-assigned immediately before use. Remove this unnecessary initialization.
> 
> This was detected by cppcheck and resolves the following warning produced
> by that tool:
> 
> [fm10k_netdev.c:1466]: (style) Variable 'size' is assigned a value that is never
> used.
> 
> Change-Id: I6f6d1ba3b9b26c2ed6f434fbeeafbbda4b78db33
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Title: fm10k: remove needless initialization of size local variable
> Change-type: ImplementationChange
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success path in function
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success path in function Jacob Keller
@ 2019-07-12 18:06   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:06 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success
> path in function
> 
> In the fm10k_handle_resume function, return 0 explicitly at the end of the
> function instead of returning the err value.
> 
> This was detected by cppcheck and resolves the following style warning
> produced by that tool:
> 
> [fm10k_pci.c:2768] -> [fm10k_pci.c:2787]: (warning) Identical condition 'err',
> second condition is always false
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when incrementing it
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when incrementing it Jacob Keller
@ 2019-07-12 18:07   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:07 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when
> incrementing it
> 
> The page_addr variable is a void pointer. Incrementing it before calling
> prefetch is technically undefined. Fix this by casting it to a u8* pointer before
> incrementing it. This ensures that we increment the pointer value in byte
> units, instead of relying on this undefined behavior.
> 
> This was detected by cppcheck, and resolves the following warning produced
> by that tool:
> 
> [fm10k_main.c:328]: (portability) 'page_addr' is of type 'void *'. When using
> void pointers in calculations, the behaviour is undefined.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters with __always_unused
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters with __always_unused Jacob Keller
@ 2019-07-12 18:07   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:07 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters
> with __always_unused
> 
> Several functions in the fm10k driver have specific function templates, as
> they are used as function pointers. The parameters in these functions are
> not always used. Explicitly mark unused parameters with the
> __always_unused macro, so that the compiler will not warn about them
> when building with the -Wunused-parameter warning enabled.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_mbx.c  |  5 ++--
>  drivers/net/ethernet/intel/fm10k/fm10k_pf.c   | 10 ++++----
>  drivers/net/ethernet/intel/fm10k/fm10k_tlv.c  |  7 +++---
> drivers/net/ethernet/intel/fm10k/fm10k_type.h |  2 +-
>  drivers/net/ethernet/intel/fm10k/fm10k_vf.c   | 25 +++++++++++--------
>  5 files changed, 28 insertions(+), 21 deletions(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 18/19] fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 18/19] fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS Jacob Keller
@ 2019-07-12 18:08   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:08 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 18/19] fm10k: convert
> NON_Q_VECTORS(hw) into NON_Q_VECTORS
> 
> The driver currently uses a macro to decide whether we should use
> NON_Q_VECTORS_PF or NON_Q_VECTORS_VF.
> 
> However, we also define NON_Q_VECTORS_VF to the same value as
> NON_Q_VECTORS_PF. This means that the macro NON_Q_VECTORS(hw) will
> always return the same value.
> 
> Let's just remove this macro, and replace it directly with an enum value on
> the enum non_q_vectors.
> 
> This was detected by cppcheck and fixes the following warnings when
> building with BUILD=KERNEL
> 
> [fm10k_ethtool.c:1123]: (style) Same value in both branches of ternary
> operator.
> 
> [fm10k_ethtool.c:1142]: (style) Same value in both branches of ternary
> operator.
> 
> [fm10k_main.c:1826]: (style) Same value in both branches of ternary
> operator.
> 
> [fm10k_main.c:1849]: (style) Same value in both branches of ternary
> operator.
> 
> [fm10k_main.c:1858]: (style) Same value in both branches of ternary
> operator.
> 
> [fm10k_pci.c:901]: (style) Same value in both branches of ternary operator.
> 
> [fm10k_pci.c:1040]: (style) Same value in both branches of ternary operator.
> 
> [fm10k_pci.c:1726]: (style) Same value in both branches of ternary operator.
> 
> [fm10k_pci.c:1763]: (style) Same value in both branches of ternary operator.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k.h         | 10 +++-------
>  drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c |  6 ++----
>  drivers/net/ethernet/intel/fm10k/fm10k_main.c    |  4 ++--
>  drivers/net/ethernet/intel/fm10k/fm10k_pci.c     |  9 ++++-----
>  4 files changed, 11 insertions(+), 18 deletions(-)


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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to read correct address
  2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to read correct address Jacob Keller
@ 2019-07-12 18:08   ` Bowers, AndrewX
  0 siblings, 0 replies; 39+ messages in thread
From: Bowers, AndrewX @ 2019-07-12 18:08 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, July 8, 2019 4:13 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to
> read correct address
> 
> Fix assignment of the FM10K_FAULT_ADDR_LO register into fault->address
> by using a bit-wise |= operation. Without this, the low address is completely
> overwriting the high potion of the address. This caused the fault to
> incorrectly return only the lower 32 bits of the fault address.
> 
> This issue was detected by cppcheck and resolves the following warnings
> produced by that tool:
> 
> [fm10k_pf.c:1668] -> [fm10k_pf.c:1670]: (style) Variable 'fault->address' is
> reassigned a value before the old one has been used.
> 
> [fm10k_pf.c:1669] -> [fm10k_pf.c:1670]: (style) Variable 'fault->address' is
> reassigned a value before the old one has been used.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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



^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2019-07-12 18:08 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 23:12 [Intel-wired-lan] [PATCH 00/19] cleanup cppcheck warnings for fm10k driver Jacob Keller
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 01/19] fm10k: reduce scope of the err variable Jacob Keller
2019-07-12 17:59   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 02/19] fm10k: reduce scope of *p local variable Jacob Keller
2019-07-12 17:59   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 03/19] fm10k: reduce the scope of qv " Jacob Keller
2019-07-12 18:00   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 04/19] fm10k: reduce the scope of local err variable Jacob Keller
2019-07-12 18:00   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 05/19] fm10k: reduce the scope of the q_idx local variable Jacob Keller
2019-07-12 18:01   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 06/19] fm10k: reduce the scope of the tx_buffer variable Jacob Keller
2019-07-12 18:02   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 07/19] fm10k: reduce the scope of the err variable Jacob Keller
2019-07-12 18:02   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 08/19] fm10k: reduce the scope of the local i variable Jacob Keller
2019-07-12 18:02   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 09/19] fm10k: reduce the scope of the local msg variable Jacob Keller
2019-07-12 18:03   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 10/19] fm10k: reduce the scope of the result local variable Jacob Keller
2019-07-12 18:04   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 11/19] fm10k: reduce scope of the ring variable Jacob Keller
2019-07-12 18:04   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 12/19] fm10k: remove unnecessary variable initializer Jacob Keller
2019-07-12 18:05   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 13/19] fm10k: remove needless assignment of err local variable Jacob Keller
2019-07-12 18:05   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 14/19] fm10k: remove needless initialization of size " Jacob Keller
2019-07-12 18:06   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 15/19] fm10k: explicitly return 0 on success path in function Jacob Keller
2019-07-12 18:06   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 16/19] fm10k: cast page_addr to u8 * when incrementing it Jacob Keller
2019-07-12 18:07   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 17/19] fm10k: mark unused parameters with __always_unused Jacob Keller
2019-07-12 18:07   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 18/19] fm10k: convert NON_Q_VECTORS(hw) into NON_Q_VECTORS Jacob Keller
2019-07-12 18:08   ` Bowers, AndrewX
2019-07-08 23:12 ` [Intel-wired-lan] [PATCH 19/19] fm10k: fix fm10k_get_fault_pf to read correct address Jacob Keller
2019-07-12 18:08   ` Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.