Commit 35e7f1be authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Bjorn Helgaas

bnx2: Replace open-coded byte swapping with swab32s()

Read NVRAM directly into buffer and use swab32s() to byte swap it in-place
instead of reading it into the end of the buffer and swapping it manually
while copying it.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/e4ac6229-1df5-8760-3a87-1ad0ace87137@gmail.comSigned-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 1a41fdb8
...@@ -8041,21 +8041,16 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp) ...@@ -8041,21 +8041,16 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
#define BNX2_VPD_LEN 128 #define BNX2_VPD_LEN 128
#define BNX2_MAX_VER_SLEN 30 #define BNX2_MAX_VER_SLEN 30
data = kmalloc(256, GFP_KERNEL); data = kmalloc(BNX2_VPD_LEN, GFP_KERNEL);
if (!data) if (!data)
return; return;
rc = bnx2_nvram_read(bp, BNX2_VPD_NVRAM_OFFSET, data + BNX2_VPD_LEN, rc = bnx2_nvram_read(bp, BNX2_VPD_NVRAM_OFFSET, data, BNX2_VPD_LEN);
BNX2_VPD_LEN);
if (rc) if (rc)
goto vpd_done; goto vpd_done;
for (i = 0; i < BNX2_VPD_LEN; i += 4) { for (i = 0; i < BNX2_VPD_LEN; i += 4)
data[i] = data[i + BNX2_VPD_LEN + 3]; swab32s((u32 *)&data[i]);
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];
}
j = pci_vpd_find_ro_info_keyword(data, BNX2_VPD_LEN, j = pci_vpd_find_ro_info_keyword(data, BNX2_VPD_LEN,
PCI_VPD_RO_KEYWORD_MFR_ID, &len); PCI_VPD_RO_KEYWORD_MFR_ID, &len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment