lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c53ff4251eba0adae6d8279a918c8ab4914b4780.1698295861.git.philipp.g.hortmann@gmail.com>
Date:   Thu, 26 Oct 2023 07:44:05 +0200
From:   Philipp Hortmann <philipp.g.hortmann@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: [PATCH 06/10] staging: rtl8192e: Convert array rx_ring[] to variable
 rx_ring

Convert array rx_ring[] to variable rx_ring as index is always 0. This
increases readability.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@...il.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 25 ++++++++++----------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  2 +-
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 2f0fc7c0f216..d0d5b1dfff48 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1157,10 +1157,10 @@ static void _rtl92e_free_rx_ring(struct net_device *dev)
 	}
 
 	dma_free_coherent(&priv->pdev->dev,
-			  sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
-			  priv->rx_ring[rx_queue_idx],
+			  sizeof(*priv->rx_ring) * priv->rxringcount,
+			  priv->rx_ring,
 			  priv->rx_ring_dma[rx_queue_idx]);
-	priv->rx_ring[rx_queue_idx] = NULL;
+	priv->rx_ring = NULL;
 }
 
 static void _rtl92e_free_tx_ring(struct net_device *dev, unsigned int prio)
@@ -1354,12 +1354,11 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 	int i;
 	int rx_queue_idx = 0;
 
-	priv->rx_ring[rx_queue_idx] = dma_alloc_coherent(&priv->pdev->dev,
-							 sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
-							 &priv->rx_ring_dma[rx_queue_idx],
-							 GFP_ATOMIC);
-	if (!priv->rx_ring[rx_queue_idx] ||
-	    (unsigned long)priv->rx_ring[rx_queue_idx] & 0xFF) {
+	priv->rx_ring = dma_alloc_coherent(&priv->pdev->dev,
+					   sizeof(*priv->rx_ring) * priv->rxringcount,
+					   &priv->rx_ring_dma[rx_queue_idx],
+					   GFP_ATOMIC);
+	if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) {
 		netdev_warn(dev, "Cannot allocate RX ring\n");
 		return -ENOMEM;
 	}
@@ -1370,7 +1369,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 		struct sk_buff *skb = dev_alloc_skb(priv->rxbuffersize);
 		dma_addr_t *mapping;
 
-		entry = &priv->rx_ring[rx_queue_idx][i];
+		entry = &priv->rx_ring[i];
 		if (!skb)
 			return 0;
 		skb->dev = dev;
@@ -1456,11 +1455,11 @@ void rtl92e_reset_desc_ring(struct net_device *dev)
 	int rx_queue_idx = 0;
 	unsigned long flags = 0;
 
-	if (priv->rx_ring[rx_queue_idx]) {
+	if (priv->rx_ring) {
 		struct rx_desc *entry = NULL;
 
 		for (i = 0; i < priv->rxringcount; i++) {
-			entry = &priv->rx_ring[rx_queue_idx][i];
+			entry = &priv->rx_ring[i];
 			entry->OWN = 1;
 		}
 		priv->rx_idx[rx_queue_idx] = 0;
@@ -1574,7 +1573,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 	stats.nic_type = NIC_8192E;
 
 	while (count--) {
-		struct rx_desc *pdesc = &priv->rx_ring[rx_queue_idx]
+		struct rx_desc *pdesc = &priv->rx_ring
 					[priv->rx_idx[rx_queue_idx]];
 		struct sk_buff *skb = priv->rx_buf[rx_queue_idx]
 				      [priv->rx_idx[rx_queue_idx]];
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index d4e998cfbefc..caa8a00cc922 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -232,7 +232,7 @@ struct r8192_priv {
 
 	u8 (*rf_set_chan)(struct net_device *dev, u8 ch);
 
-	struct rx_desc *rx_ring[MAX_RX_QUEUE];
+	struct rx_desc *rx_ring;
 	struct sk_buff	*rx_buf[MAX_RX_QUEUE][MAX_RX_COUNT];
 	dma_addr_t	rx_ring_dma[MAX_RX_QUEUE];
 	unsigned int	rx_idx[MAX_RX_QUEUE];
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ