[<prev] [next>] [day] [month] [year] [list]
Message-ID: <e4ac6229-1df5-8760-3a87-1ad0ace87137@gmail.com>
Date: Sun, 22 Aug 2021 15:52:01 +0200
From: Heiner Kallweit <hkallweit1@...il.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
Rasesh Mody <rmody@...vell.com>, GR-Linux-NIC-Dev@...vell.com,
Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...emloft.net>
Cc: "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
SCSI development list <linux-scsi@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH 04/12] bnx2: Replace open-coded version with swab32s()
Use swab32s() instead of open-coding it.
Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index de1a60a95..599fc1436 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8041,21 +8041,16 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
#define BNX2_VPD_LEN 128
#define BNX2_MAX_VER_SLEN 30
- data = kmalloc(256, GFP_KERNEL);
+ data = kmalloc(BNX2_VPD_LEN, GFP_KERNEL);
if (!data)
return;
- rc = bnx2_nvram_read(bp, BNX2_VPD_NVRAM_OFFSET, data + BNX2_VPD_LEN,
- BNX2_VPD_LEN);
+ rc = bnx2_nvram_read(bp, BNX2_VPD_NVRAM_OFFSET, data, BNX2_VPD_LEN);
if (rc)
goto vpd_done;
- for (i = 0; i < BNX2_VPD_LEN; i += 4) {
- data[i] = data[i + BNX2_VPD_LEN + 3];
- data[i + 1] = data[i + BNX2_VPD_LEN + 2];
- data[i + 2] = data[i + BNX2_VPD_LEN + 1];
- data[i + 3] = data[i + BNX2_VPD_LEN];
- }
+ for (i = 0; i < BNX2_VPD_LEN; i += 4)
+ swab32s((u32 *)&data[i]);
j = pci_vpd_find_ro_info_keyword(data, BNX2_VPD_LEN,
PCI_VPD_RO_KEYWORD_MFR_ID, &len);
--
2.33.0
Powered by blists - more mailing lists