Skip to content

Commit

Permalink
bnx2: Replace open-coded version with swab32s()
Browse files Browse the repository at this point in the history
Use swab32s() instead of open-coding it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Aug 22, 2021
1 parent ddc122a commit 0df79c8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions drivers/net/ethernet/broadcom/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0df79c8

Please sign in to comment.