[PATCH 3/6] staging: et131x: Reduce indenting in et131x_rx_dma_memory_free()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This change negates an 'if' statement, allowing a large block of code
to be un-indented, making the code more readable.

Signed-off-by: Mark Einon <mark.einon@xxxxxxxxx>
---
 drivers/staging/et131x/et131x.c |   36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 153ab15..64b3db4 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -2443,33 +2443,33 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
 
 	/* Free Free Buffer Rings */
 	for (id = 0; id < NUM_FBRS; id++) {
-		if (rx_ring->fbr[id]->ring_virtaddr) {
-			/* First the packet memory */
-			for (index = 0; index <
-				(rx_ring->fbr[id]->num_entries / FBR_CHUNKS);
-			     index++) {
-				if (rx_ring->fbr[id]->mem_virtaddrs[index]) {
+		if (!rx_ring->fbr[id]->ring_virtaddr)
+			continue;
 
-					bufsize = (rx_ring->fbr[id]->buffsize * FBR_CHUNKS);
+		/* First the packet memory */
+		for (index = 0;
+		     index < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS);
+		     index++) {
+			if (rx_ring->fbr[id]->mem_virtaddrs[index]) {
+				bufsize = (rx_ring->fbr[id]->buffsize * FBR_CHUNKS);
 
-					dma_free_coherent(&adapter->pdev->dev,
-						bufsize,
-						rx_ring->fbr[id]->mem_virtaddrs[index],
-						rx_ring->fbr[id]->mem_physaddrs[index]);
+				dma_free_coherent(&adapter->pdev->dev,
+					bufsize,
+					rx_ring->fbr[id]->mem_virtaddrs[index],
+					rx_ring->fbr[id]->mem_physaddrs[index]);
 
-					rx_ring->fbr[id]->mem_virtaddrs[index] = NULL;
-				}
+				rx_ring->fbr[id]->mem_virtaddrs[index] = NULL;
 			}
+		}
 
 		bufsize =
 		    (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries);
 
-			dma_free_coherent(&adapter->pdev->dev, bufsize,
-					    rx_ring->fbr[id]->ring_virtaddr,
-					    rx_ring->fbr[id]->ring_physaddr);
+		dma_free_coherent(&adapter->pdev->dev, bufsize,
+				    rx_ring->fbr[id]->ring_virtaddr,
+				    rx_ring->fbr[id]->ring_physaddr);
 
-			rx_ring->fbr[id]->ring_virtaddr = NULL;
-		}
+		rx_ring->fbr[id]->ring_virtaddr = NULL;
 	}
 
 	/* Free Packet Status Ring */
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux