Skip to contentSkip to conversation

rtl8139: fix clang reporting unused assignment of VLAN tagging data

PATCH Applied Igor V. Kovalenko 4 participants 4 messages Jan 13, 2010 – Jan 19, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtl8139: fix clang reporting unused assignment of VLAN tagging data

From: Igor V. Kovalenko <[email protected]>

Currently we do not implement VLAN tagging for rtl8139(C+), still data is read from ring buffer headers.

- augment unused assignment with TODO item
- cast txdw1 to void for now

---
 hw/rtl8139.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
hw/rtl8139.c +5 -0
index 1f4f585..f04dd54 100644
@@ -1909,6 +1909,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
 
     cpu_physical_memory_read(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
     txdw0 = le32_to_cpu(val);
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
     cpu_physical_memory_read(cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
     txdw1 = le32_to_cpu(val);
     cpu_physical_memory_read(cplus_tx_ring_desc+8,  (uint8_t *)&val, 4);
@@ -1920,6 +1921,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
            descriptor,
            txdw0, txdw1, txbufLO, txbufHI));
 
+    /* TODO: the following discard cast should clean clang analyzer output */
+    (void)txdw1;
+
 /* w0 ownership flag */
 #define CP_TX_OWN (1<<31)
 /* w0 end of ring flag */
@@ -2045,6 +2049,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
     /* update ring data */
     val = cpu_to_le32(txdw0);
     cpu_physical_memory_write(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
 //    val = cpu_to_le32(txdw1);
 //    cpu_physical_memory_write(cplus_tx_ring_desc+4,  &val, 4);
 
#1 lore raw
Quoted 14 lines
hw/rtl8139.c +1 -0
index 1f4f585..f04dd54 100644
@@ -1909,6 +1909,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
 
      cpu_physical_memory_read(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
      txdw0 = le32_to_cpu(val);
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
      cpu_physical_memory_read(cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
      txdw1 = le32_to_cpu(val);
      cpu_physical_memory_read(cplus_tx_ring_desc+8,  (uint8_t *)&val, 4);

hw/rtl8139.c static int rtl8139_cplus_transmit_one(RTL8139State *s) · line 1925

Quoted 5 lines
hw/rtl8139.c +2 -0
@@ -1920,6 +1921,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
             descriptor,
             txdw0, txdw1, txbufLO, txbufHI));
 
+    /* TODO: the following discard cast should clean clang analyzer output */
+    (void)txdw1;

I don't like this, why not comment it out like here:

hw/rtl8139.c static int rtl8139_cplus_transmit_one(RTL8139State *s)

Quoted 3 lines
hw/rtl8139.c +1 -0
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
  //    val = cpu_to_le32(txdw1);
  //    cpu_physical_memory_write(cplus_tx_ring_desc+4,&val, 4);

(and maybe change this one as well to #if 0...#endif, I don't know).

Paolo

#2 lore raw
Quoted 22 lines · Paolo Bonzini
Quoted 14 lines
hw/rtl8139.c +1 -0
index 1f4f585..f04dd54 100644
@@ -1909,6 +1909,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
 
     cpu_physical_memory_read(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
     txdw0 = le32_to_cpu(val);
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
     cpu_physical_memory_read(cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
     txdw1 = le32_to_cpu(val);
     cpu_physical_memory_read(cplus_tx_ring_desc+8,  (uint8_t *)&val, 4);

hw/rtl8139.c static int rtl8139_cplus_transmit_one(RTL8139State *s) · line 1925

Quoted 5 lines
hw/rtl8139.c +2 -0
@@ -1920,6 +1921,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
            descriptor,
            txdw0, txdw1, txbufLO, txbufHI));
 
+    /* TODO: the following discard cast should clean clang analyzer output */
+    (void)txdw1;

I don't like this, why not comment it out like here:

Quoted 5 lines

hw/rtl8139.c static int rtl8139_cplus_transmit_one(RTL8139State *s)

Quoted 3 lines
hw/rtl8139.c +1 -0
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
 //    val = cpu_to_le32(txdw1);
 //    cpu_physical_memory_write(cplus_tx_ring_desc+4,&val, 4);

(and maybe change this one as well to #if 0...#endif, I don't know).

Personally I'd rather that all of this was removed until the feature is implemented.

#3 lore raw
In reply to Igor V. Kovalenko
Quoted 10 lines · Igor V. Kovalenko

From: Igor V. Kovalenko<[email protected]>

Currently we do not implement VLAN tagging for rtl8139(C+), still data is read from ring buffer headers.

- augment unused assignment with TODO item
- cast txdw1 to void for now

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 39 lines
---
  hw/rtl8139.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)
hw/rtl8139.c +5 -0
index 1f4f585..f04dd54 100644
@@ -1909,6 +1909,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
 
      cpu_physical_memory_read(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
      txdw0 = le32_to_cpu(val);
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
      cpu_physical_memory_read(cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
      txdw1 = le32_to_cpu(val);
      cpu_physical_memory_read(cplus_tx_ring_desc+8,  (uint8_t *)&val, 4);
@@ -1920,6 +1921,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
             descriptor,
             txdw0, txdw1, txbufLO, txbufHI));
 
+    /* TODO: the following discard cast should clean clang analyzer output */
+    (void)txdw1;
+
  /* w0 ownership flag */
  #define CP_TX_OWN (1<<31)
  /* w0 end of ring flag */
@@ -2045,6 +2049,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
      /* update ring data */
      val = cpu_to_le32(txdw0);
      cpu_physical_memory_write(cplus_tx_ring_desc,    (uint8_t *)&val, 4);
+    /* TODO: implement VLAN tagging support, VLAN tag data is read to txdw1 */
  //    val = cpu_to_le32(txdw1);
  //    cpu_physical_memory_write(cplus_tx_ring_desc+4,&val, 4);