Skip to contentSkip to conversation

netdev: octeon_mgmt: Fix ISO C90 forbids mixed declarations and code warning.

PATCH In review David Daney 2 participants 2 messages Sep 15, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netdev: octeon_mgmt: Fix ISO C90 forbids mixed declarations and code warning.

From: David Daney <[email protected]>

We were getting:

drivers/net/ethernet/octeon/octeon_mgmt.c:295:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

The idea of the fix from Joe Perches.

Cc Heinrich Schuchardt <[email protected]>
Cc Joe Perches <[email protected]>

---

This patch should supersede previous patches from Heinrich Schuchardt, and may be preferable as it touches fewer lines of code.

 drivers/net/ethernet/octeon/octeon_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/octeon/octeon_mgmt.c +1 -1
index 979c698..5e10c1d 100644
@@ -290,12 +290,12 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
 		/* Read the hardware TX timestamp if one was recorded */
 		if (unlikely(re.s.tstamp)) {
 			struct skb_shared_hwtstamps ts;
-			memset(&ts, 0, sizeof(ts));
 			/* Read the timestamp */
 			u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
 			/* Remove the timestamp from the FIFO */
 			cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
 			/* Tell the kernel about the timestamp */
+			memset(&ts, 0, sizeof(ts));
 			ts.hwtstamp = ns_to_ktime(ns);
 			skb_tstamp_tx(skb, &ts);
 		}
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 11 lines · David Daney

From: David Daney <[email protected]>

We were getting:

drivers/net/ethernet/octeon/octeon_mgmt.c:295:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

The idea of the fix from Joe Perches.

Cc Heinrich Schuchardt <[email protected]>
Cc Joe Perches <[email protected]>

Actually Aaro Koskinen's similar patch was just committed to the net.git tree (commit 208f7ca4d4a6886256763c9c073775c5fdaf47eb), so this whole thing seems to have been an exercise in time wasting.

I don't really care which patch goes in at this point. So I defer to davem et al.

David Daney

Quoted 27 lines

---

This patch should supersede previous patches from Heinrich Schuchardt, and may be preferable as it touches fewer lines of code.

  drivers/net/ethernet/octeon/octeon_mgmt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/octeon/octeon_mgmt.c +1 -1
index 979c698..5e10c1d 100644
@@ -290,12 +290,12 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
  		/* Read the hardware TX timestamp if one was recorded */
  		if (unlikely(re.s.tstamp)) {
  			struct skb_shared_hwtstamps ts;
-			memset(&ts, 0, sizeof(ts));
  			/* Read the timestamp */
  			u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
  			/* Remove the timestamp from the FIFO */
  			cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
  			/* Tell the kernel about the timestamp */
+			memset(&ts, 0, sizeof(ts));
  			ts.hwtstamp = ns_to_ktime(ns);
  			skb_tstamp_tx(skb, &ts);
  		}