Skip to contentSkip to conversation

net/rocker: Cleanup the useless return value check

PATCH Applied Mao Zhongyi 2 participants 3 messages May 24, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/rocker: Cleanup the useless return value check

None of pci_dma_read()'s callers check the return value except rocker. There is no need to check it because it always return
0. So the check work is useless. Remove it entirely.

---
 hw/net/rocker/rocker.c      | 9 +++------
 hw/net/rocker/rocker_desc.c | 4 +---
 2 files changed, 4 insertions(+), 9 deletions(-)
hw/net/rocker/rocker.c +3 -6
index 6e70fdd..4f0f6d7 100644
@@ -244,11 +244,9 @@ static int tx_consume(Rocker *r, DescInfo *info)
             goto err_no_mem;
         }
 
-        if (pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
-                     iov[iovcnt].iov_len)) {
-            err = -ROCKER_ENXIO;
-            goto err_bad_io;
-        }
+        pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
+                     iov[iovcnt].iov_len);
+
         iovcnt++;
     }
 
@@ -261,7 +259,6 @@ static int tx_consume(Rocker *r, DescInfo *info)
     err = fp_port_eg(r->fp_port[port], iov, iovcnt);
 
 err_too_many_frags:
-err_bad_io:
 err_no_mem:
 err_bad_attr:
     for (i = 0; i < ROCKER_TX_FRAGS_MAX; i++) {
hw/net/rocker/rocker_desc.c +1 -3
index ac02797..6184c40 100644
@@ -69,9 +69,7 @@ char *desc_get_buf(DescInfo *info, bool read_only)
         return NULL;
     }
 
-    if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) {
-        return NULL;
-    }
+    pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size);
 
     return info->buf;
 }
Signature · 1 line
2.9.3
Applied
#1 lore raw
Quoted 43 lines · Mao Zhongyi

None of pci_dma_read()'s callers check the return value except rocker. There is no need to check it because it always return
0. So the check work is useless. Remove it entirely.

---
  hw/net/rocker/rocker.c      | 9 +++------
  hw/net/rocker/rocker_desc.c | 4 +---
  2 files changed, 4 insertions(+), 9 deletions(-)
hw/net/rocker/rocker.c +3 -6
index 6e70fdd..4f0f6d7 100644
@@ -244,11 +244,9 @@ static int tx_consume(Rocker *r, DescInfo *info)
              goto err_no_mem;
          }
 
-        if (pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
-                     iov[iovcnt].iov_len)) {
-            err = -ROCKER_ENXIO;
-            goto err_bad_io;
-        }
+        pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
+                     iov[iovcnt].iov_len);
+
          iovcnt++;
      }
 
@@ -261,7 +259,6 @@ static int tx_consume(Rocker *r, DescInfo *info)
      err = fp_port_eg(r->fp_port[port], iov, iovcnt);
 
  err_too_many_frags:
-err_bad_io:
  err_no_mem:
  err_bad_attr:
      for (i = 0; i < ROCKER_TX_FRAGS_MAX; i++) {
hw/net/rocker/rocker_desc.c +0 -0
index ac02797..6184c40 100644

hw/net/rocker/rocker_desc.c char *desc_get_buf(DescInfo *info, bool read_only) · line 75

Quoted 10 lines
hw/net/rocker/rocker_desc.c +1 -3
@@ -69,9 +69,7 @@ char *desc_get_buf(DescInfo *info, bool read_only)
          return NULL;
      }
 
-    if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) {
-        return NULL;
-    }
+    pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size);
 
      return info->buf;
  }

Applied, thanks.