diff options
author | David S. Miller <davem@davemloft.net> | 2021-08-23 11:01:35 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-23 11:01:35 +0100 |
commit | 197c316ce45048b96aca1901b230eb81b579ff03 (patch) | |
tree | f50c45277354a42620e07905147404cdd41a36ce /drivers/net/ethernet | |
parent | 54c0bcc02857006f03e3dbc5c9f63d5c7629c303 (diff) | |
download | linux-197c316ce45048b96aca1901b230eb81b579ff03.tar.gz |
Revert "bnxt: Read VPD with pci_vpd_alloc()"
This reverts commit ebcdc8ebe8acbaef5d130350a8082e12ac7d4e61.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 00a9b71267a8..893bdaf03043 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -13171,17 +13171,22 @@ static int bnxt_init_mac_addr(struct bnxt *bp) return rc; } +#define BNXT_VPD_LEN 512 static void bnxt_vpd_read_info(struct bnxt *bp) { struct pci_dev *pdev = bp->pdev; int i, len, pos, ro_size, size; - unsigned int vpd_size; + ssize_t vpd_size; u8 *vpd_data; - vpd_data = pci_vpd_alloc(pdev, &vpd_size); - if (IS_ERR(vpd_data)) { - pci_warn(pdev, "Unable to read VPD\n"); + vpd_data = kmalloc(BNXT_VPD_LEN, GFP_KERNEL); + if (!vpd_data) return; + + vpd_size = pci_read_vpd(pdev, 0, BNXT_VPD_LEN, vpd_data); + if (vpd_size <= 0) { + netdev_err(bp->dev, "Unable to read VPD\n"); + goto exit; } i = pci_vpd_find_tag(vpd_data, vpd_size, PCI_VPD_LRDT_RO_DATA); |