aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-02-20 16:25:51 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-25 17:36:35 -0500
commitcd2b0389dc304c6a7fa2ebae200f246059c68dd9 (patch)
tree6ca645d573cebfe45567671df3ef989549ba45c2 /drivers/net/ethernet/broadcom
parent51adfcc333e1490d3a22490f5b3504f64c7b28b4 (diff)
bnx2x: Remove hidden flow control goto from BNX2X_ALLOC macros
BNX2X_ALLOC macros use "goto alloc_mem_err" so these labels appear unused in some functions. Expand these macros in-place via coccinelle and some typing. Update the macros to use statement expressions and remove the BNX2X_ALLOC macro. This adds some > 80 char lines. $ cat bnx2x_pci_alloc.cocci @@ expression e1; expression e2; expression e3; @@ - BNX2X_PCI_ALLOC(e1, e2, e3); + e1 = BNX2X_PCI_ALLOC(e2, e3); if (!e1) goto alloc_mem_err; @@ expression e1; expression e2; expression e3; @@ - BNX2X_PCI_FALLOC(e1, e2, e3); + e1 = BNX2X_PCI_FALLOC(e2, e3); if (!e1) goto alloc_mem_err; @@ expression e1; expression e2; @@ - BNX2X_ALLOC(e1, e2); + e1 = kzalloc(e2, GFP_KERNEL); if (!e1) goto alloc_mem_err; @@ expression e1; expression e2; expression e3; @@ - kzalloc(sizeof(e1) * e2, e3) + kcalloc(e2, sizeof(e1), e3) @@ expression e1; expression e2; expression e3; @@ - kzalloc(e1 * sizeof(e2), e3) + kcalloc(e1, sizeof(e2), e3) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c77
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h45
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c69
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c36
4 files changed, 138 insertions, 89 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 5ee13af78e53..89d75c24335c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2228,8 +2228,10 @@ static int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp)
2228 sizeof(struct per_queue_stats) * num_queue_stats + 2228 sizeof(struct per_queue_stats) * num_queue_stats +
2229 sizeof(struct stats_counter); 2229 sizeof(struct stats_counter);
2230 2230
2231 BNX2X_PCI_ALLOC(bp->fw_stats, &bp->fw_stats_mapping, 2231 bp->fw_stats = BNX2X_PCI_ALLOC(&bp->fw_stats_mapping,
2232 bp->fw_stats_data_sz + bp->fw_stats_req_sz); 2232 bp->fw_stats_data_sz + bp->fw_stats_req_sz);
2233 if (!bp->fw_stats)
2234 goto alloc_mem_err;
2233 2235
2234 /* Set shortcuts */ 2236 /* Set shortcuts */
2235 bp->fw_stats_req = (struct bnx2x_fw_stats_req *)bp->fw_stats; 2237 bp->fw_stats_req = (struct bnx2x_fw_stats_req *)bp->fw_stats;
@@ -4357,14 +4359,17 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)
4357 4359
4358 if (!IS_FCOE_IDX(index)) { 4360 if (!IS_FCOE_IDX(index)) {
4359 /* status blocks */ 4361 /* status blocks */
4360 if (!CHIP_IS_E1x(bp)) 4362 if (!CHIP_IS_E1x(bp)) {
4361 BNX2X_PCI_ALLOC(sb->e2_sb, 4363 sb->e2_sb = BNX2X_PCI_ALLOC(&bnx2x_fp(bp, index, status_blk_mapping),
4362 &bnx2x_fp(bp, index, status_blk_mapping), 4364 sizeof(struct host_hc_status_block_e2));
4363 sizeof(struct host_hc_status_block_e2)); 4365 if (!sb->e2_sb)
4364 else 4366 goto alloc_mem_err;
4365 BNX2X_PCI_ALLOC(sb->e1x_sb, 4367 } else {
4366 &bnx2x_fp(bp, index, status_blk_mapping), 4368 sb->e1x_sb = BNX2X_PCI_ALLOC(&bnx2x_fp(bp, index, status_blk_mapping),
4367 sizeof(struct host_hc_status_block_e1x)); 4369 sizeof(struct host_hc_status_block_e1x));
4370 if (!sb->e1x_sb)
4371 goto alloc_mem_err;
4372 }
4368 } 4373 }
4369 4374
4370 /* FCoE Queue uses Default SB and doesn't ACK the SB, thus no need to 4375 /* FCoE Queue uses Default SB and doesn't ACK the SB, thus no need to
@@ -4383,35 +4388,49 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)
4383 "allocating tx memory of fp %d cos %d\n", 4388 "allocating tx memory of fp %d cos %d\n",
4384 index, cos); 4389 index, cos);
4385 4390
4386 BNX2X_ALLOC(txdata->tx_buf_ring, 4391 txdata->tx_buf_ring = kcalloc(NUM_TX_BD,
4387 sizeof(struct sw_tx_bd) * NUM_TX_BD); 4392 sizeof(struct sw_tx_bd),
4388 BNX2X_PCI_ALLOC(txdata->tx_desc_ring, 4393 GFP_KERNEL);
4389 &txdata->tx_desc_mapping, 4394 if (!txdata->tx_buf_ring)
4390 sizeof(union eth_tx_bd_types) * NUM_TX_BD); 4395 goto alloc_mem_err;
4396 txdata->tx_desc_ring = BNX2X_PCI_ALLOC(&txdata->tx_desc_mapping,
4397 sizeof(union eth_tx_bd_types) * NUM_TX_BD);
4398 if (!txdata->tx_desc_ring)
4399 goto alloc_mem_err;
4391 } 4400 }
4392 } 4401 }
4393 4402
4394 /* Rx */ 4403 /* Rx */
4395 if (!skip_rx_queue(bp, index)) { 4404 if (!skip_rx_queue(bp, index)) {
4396 /* fastpath rx rings: rx_buf rx_desc rx_comp */ 4405 /* fastpath rx rings: rx_buf rx_desc rx_comp */
4397 BNX2X_ALLOC(bnx2x_fp(bp, index, rx_buf_ring), 4406 bnx2x_fp(bp, index, rx_buf_ring) =
4398 sizeof(struct sw_rx_bd) * NUM_RX_BD); 4407 kcalloc(NUM_RX_BD, sizeof(struct sw_rx_bd), GFP_KERNEL);
4399 BNX2X_PCI_ALLOC(bnx2x_fp(bp, index, rx_desc_ring), 4408 if (!bnx2x_fp(bp, index, rx_buf_ring))
4400 &bnx2x_fp(bp, index, rx_desc_mapping), 4409 goto alloc_mem_err;
4401 sizeof(struct eth_rx_bd) * NUM_RX_BD); 4410 bnx2x_fp(bp, index, rx_desc_ring) =
4411 BNX2X_PCI_ALLOC(&bnx2x_fp(bp, index, rx_desc_mapping),
4412 sizeof(struct eth_rx_bd) * NUM_RX_BD);
4413 if (!bnx2x_fp(bp, index, rx_desc_ring))
4414 goto alloc_mem_err;
4402 4415
4403 /* Seed all CQEs by 1s */ 4416 /* Seed all CQEs by 1s */
4404 BNX2X_PCI_FALLOC(bnx2x_fp(bp, index, rx_comp_ring), 4417 bnx2x_fp(bp, index, rx_comp_ring) =
4405 &bnx2x_fp(bp, index, rx_comp_mapping), 4418 BNX2X_PCI_FALLOC(&bnx2x_fp(bp, index, rx_comp_mapping),
4406 sizeof(struct eth_fast_path_rx_cqe) * 4419 sizeof(struct eth_fast_path_rx_cqe) * NUM_RCQ_BD);
4407 NUM_RCQ_BD); 4420 if (!bnx2x_fp(bp, index, rx_comp_ring))
4421 goto alloc_mem_err;
4408 4422
4409 /* SGE ring */ 4423 /* SGE ring */
4410 BNX2X_ALLOC(bnx2x_fp(bp, index, rx_page_ring), 4424 bnx2x_fp(bp, index, rx_page_ring) =
4411 sizeof(struct sw_rx_page) * NUM_RX_SGE); 4425 kcalloc(NUM_RX_SGE, sizeof(struct sw_rx_page),
4412 BNX2X_PCI_ALLOC(bnx2x_fp(bp, index, rx_sge_ring), 4426 GFP_KERNEL);
4413 &bnx2x_fp(bp, index, rx_sge_mapping), 4427 if (!bnx2x_fp(bp, index, rx_page_ring))
4414 BCM_PAGE_SIZE * NUM_RX_SGE_PAGES); 4428 goto alloc_mem_err;
4429 bnx2x_fp(bp, index, rx_sge_ring) =
4430 BNX2X_PCI_ALLOC(&bnx2x_fp(bp, index, rx_sge_mapping),
4431 BCM_PAGE_SIZE * NUM_RX_SGE_PAGES);
4432 if (!bnx2x_fp(bp, index, rx_sge_ring))
4433 goto alloc_mem_err;
4415 /* RX BD ring */ 4434 /* RX BD ring */
4416 bnx2x_set_next_page_rx_bd(fp); 4435 bnx2x_set_next_page_rx_bd(fp);
4417 4436
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index ec02b15fba32..05f4f5f52635 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -47,31 +47,26 @@ extern int bnx2x_num_queues;
47 } \ 47 } \
48 } while (0) 48 } while (0)
49 49
50#define BNX2X_PCI_ALLOC(x, y, size) \ 50#define BNX2X_PCI_ALLOC(y, size) \
51 do { \ 51({ \
52 x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ 52 void *x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
53 if (x == NULL) \ 53 if (x) \
54 goto alloc_mem_err; \ 54 DP(NETIF_MSG_HW, \
55 DP(NETIF_MSG_HW, "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \ 55 "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
56 (unsigned long long)(*y), x); \ 56 (unsigned long long)(*y), x); \
57 } while (0) 57 x; \
58 58})
59#define BNX2X_PCI_FALLOC(x, y, size) \ 59#define BNX2X_PCI_FALLOC(y, size) \
60 do { \ 60({ \
61 x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \ 61 void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
62 if (x == NULL) \ 62 if (x) { \
63 goto alloc_mem_err; \ 63 memset(x, 0xff, size); \
64 memset((void *)x, 0xFFFFFFFF, size); \ 64 DP(NETIF_MSG_HW, \
65 DP(NETIF_MSG_HW, "BNX2X_PCI_FALLOC: Physical %Lx Virtual %p\n",\ 65 "BNX2X_PCI_FALLOC: Physical %Lx Virtual %p\n", \
66 (unsigned long long)(*y), x); \ 66 (unsigned long long)(*y), x); \
67 } while (0) 67 } \
68 68 x; \
69#define BNX2X_ALLOC(x, size) \ 69})
70 do { \
71 x = kzalloc(size, GFP_KERNEL); \
72 if (x == NULL) \
73 goto alloc_mem_err; \
74 } while (0)
75 70
76/*********************** Interfaces **************************** 71/*********************** Interfaces ****************************
77 * Functions that need to be implemented by each driver version 72 * Functions that need to be implemented by each driver version
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 84439152e499..230dea623895 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -8001,19 +8001,25 @@ void bnx2x_free_mem(struct bnx2x *bp)
8001 8001
8002int bnx2x_alloc_mem_cnic(struct bnx2x *bp) 8002int bnx2x_alloc_mem_cnic(struct bnx2x *bp)
8003{ 8003{
8004 if (!CHIP_IS_E1x(bp)) 8004 if (!CHIP_IS_E1x(bp)) {
8005 /* size = the status block + ramrod buffers */ 8005 /* size = the status block + ramrod buffers */
8006 BNX2X_PCI_ALLOC(bp->cnic_sb.e2_sb, &bp->cnic_sb_mapping, 8006 bp->cnic_sb.e2_sb = BNX2X_PCI_ALLOC(&bp->cnic_sb_mapping,
8007 sizeof(struct host_hc_status_block_e2)); 8007 sizeof(struct host_hc_status_block_e2));
8008 else 8008 if (!bp->cnic_sb.e2_sb)
8009 BNX2X_PCI_ALLOC(bp->cnic_sb.e1x_sb, 8009 goto alloc_mem_err;
8010 &bp->cnic_sb_mapping, 8010 } else {
8011 sizeof(struct 8011 bp->cnic_sb.e1x_sb = BNX2X_PCI_ALLOC(&bp->cnic_sb_mapping,
8012 host_hc_status_block_e1x)); 8012 sizeof(struct host_hc_status_block_e1x));
8013 if (!bp->cnic_sb.e1x_sb)
8014 goto alloc_mem_err;
8015 }
8013 8016
8014 if (CONFIGURE_NIC_MODE(bp) && !bp->t2) 8017 if (CONFIGURE_NIC_MODE(bp) && !bp->t2) {
8015 /* allocate searcher T2 table, as it wasn't allocated before */ 8018 /* allocate searcher T2 table, as it wasn't allocated before */
8016 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); 8019 bp->t2 = BNX2X_PCI_ALLOC(&bp->t2_mapping, SRC_T2_SZ);
8020 if (!bp->t2)
8021 goto alloc_mem_err;
8022 }
8017 8023
8018 /* write address to which L5 should insert its values */ 8024 /* write address to which L5 should insert its values */
8019 bp->cnic_eth_dev.addr_drv_info_to_mcp = 8025 bp->cnic_eth_dev.addr_drv_info_to_mcp =
@@ -8034,15 +8040,22 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
8034{ 8040{
8035 int i, allocated, context_size; 8041 int i, allocated, context_size;
8036 8042
8037 if (!CONFIGURE_NIC_MODE(bp) && !bp->t2) 8043 if (!CONFIGURE_NIC_MODE(bp) && !bp->t2) {
8038 /* allocate searcher T2 table */ 8044 /* allocate searcher T2 table */
8039 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); 8045 bp->t2 = BNX2X_PCI_ALLOC(&bp->t2_mapping, SRC_T2_SZ);
8046 if (!bp->t2)
8047 goto alloc_mem_err;
8048 }
8040 8049
8041 BNX2X_PCI_ALLOC(bp->def_status_blk, &bp->def_status_blk_mapping, 8050 bp->def_status_blk = BNX2X_PCI_ALLOC(&bp->def_status_blk_mapping,
8042 sizeof(struct host_sp_status_block)); 8051 sizeof(struct host_sp_status_block));
8052 if (!bp->def_status_blk)
8053 goto alloc_mem_err;
8043 8054
8044 BNX2X_PCI_ALLOC(bp->slowpath, &bp->slowpath_mapping, 8055 bp->slowpath = BNX2X_PCI_ALLOC(&bp->slowpath_mapping,
8045 sizeof(struct bnx2x_slowpath)); 8056 sizeof(struct bnx2x_slowpath));
8057 if (!bp->slowpath)
8058 goto alloc_mem_err;
8046 8059
8047 /* Allocate memory for CDU context: 8060 /* Allocate memory for CDU context:
8048 * This memory is allocated separately and not in the generic ILT 8061 * This memory is allocated separately and not in the generic ILT
@@ -8062,12 +8075,16 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
8062 for (i = 0, allocated = 0; allocated < context_size; i++) { 8075 for (i = 0, allocated = 0; allocated < context_size; i++) {
8063 bp->context[i].size = min(CDU_ILT_PAGE_SZ, 8076 bp->context[i].size = min(CDU_ILT_PAGE_SZ,
8064 (context_size - allocated)); 8077 (context_size - allocated));
8065 BNX2X_PCI_ALLOC(bp->context[i].vcxt, 8078 bp->context[i].vcxt = BNX2X_PCI_ALLOC(&bp->context[i].cxt_mapping,
8066 &bp->context[i].cxt_mapping, 8079 bp->context[i].size);
8067 bp->context[i].size); 8080 if (!bp->context[i].vcxt)
8081 goto alloc_mem_err;
8068 allocated += bp->context[i].size; 8082 allocated += bp->context[i].size;
8069 } 8083 }
8070 BNX2X_ALLOC(bp->ilt->lines, sizeof(struct ilt_line) * ILT_MAX_LINES); 8084 bp->ilt->lines = kcalloc(ILT_MAX_LINES, sizeof(struct ilt_line),
8085 GFP_KERNEL);
8086 if (!bp->ilt->lines)
8087 goto alloc_mem_err;
8071 8088
8072 if (bnx2x_ilt_mem_op(bp, ILT_MEMOP_ALLOC)) 8089 if (bnx2x_ilt_mem_op(bp, ILT_MEMOP_ALLOC))
8073 goto alloc_mem_err; 8090 goto alloc_mem_err;
@@ -8076,11 +8093,15 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
8076 goto alloc_mem_err; 8093 goto alloc_mem_err;
8077 8094
8078 /* Slow path ring */ 8095 /* Slow path ring */
8079 BNX2X_PCI_ALLOC(bp->spq, &bp->spq_mapping, BCM_PAGE_SIZE); 8096 bp->spq = BNX2X_PCI_ALLOC(&bp->spq_mapping, BCM_PAGE_SIZE);
8097 if (!bp->spq)
8098 goto alloc_mem_err;
8080 8099
8081 /* EQ */ 8100 /* EQ */
8082 BNX2X_PCI_ALLOC(bp->eq_ring, &bp->eq_mapping, 8101 bp->eq_ring = BNX2X_PCI_ALLOC(&bp->eq_mapping,
8083 BCM_PAGE_SIZE * NUM_EQ_PAGES); 8102 BCM_PAGE_SIZE * NUM_EQ_PAGES);
8103 if (!bp->eq_ring)
8104 goto alloc_mem_err;
8084 8105
8085 return 0; 8106 return 0;
8086 8107
@@ -11954,7 +11975,7 @@ static int bnx2x_init_mcast_macs_list(struct bnx2x *bp,
11954{ 11975{
11955 int mc_count = netdev_mc_count(bp->dev); 11976 int mc_count = netdev_mc_count(bp->dev);
11956 struct bnx2x_mcast_list_elem *mc_mac = 11977 struct bnx2x_mcast_list_elem *mc_mac =
11957 kzalloc(sizeof(*mc_mac) * mc_count, GFP_ATOMIC); 11978 kcalloc(mc_count, sizeof(*mc_mac), GFP_ATOMIC);
11958 struct netdev_hw_addr *ha; 11979 struct netdev_hw_addr *ha;
11959 11980
11960 if (!mc_mac) 11981 if (!mc_mac)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 98b53671a652..61e6f606d8a4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -2120,7 +2120,9 @@ int bnx2x_iov_alloc_mem(struct bnx2x *bp)
2120 cxt->size = min_t(size_t, tot_size, CDU_ILT_PAGE_SZ); 2120 cxt->size = min_t(size_t, tot_size, CDU_ILT_PAGE_SZ);
2121 2121
2122 if (cxt->size) { 2122 if (cxt->size) {
2123 BNX2X_PCI_ALLOC(cxt->addr, &cxt->mapping, cxt->size); 2123 cxt->addr = BNX2X_PCI_ALLOC(&cxt->mapping, cxt->size);
2124 if (!cxt->addr)
2125 goto alloc_mem_err;
2124 } else { 2126 } else {
2125 cxt->addr = NULL; 2127 cxt->addr = NULL;
2126 cxt->mapping = 0; 2128 cxt->mapping = 0;
@@ -2130,20 +2132,28 @@ int bnx2x_iov_alloc_mem(struct bnx2x *bp)
2130 2132
2131 /* allocate vfs ramrods dma memory - client_init and set_mac */ 2133 /* allocate vfs ramrods dma memory - client_init and set_mac */
2132 tot_size = BNX2X_NR_VIRTFN(bp) * sizeof(struct bnx2x_vf_sp); 2134 tot_size = BNX2X_NR_VIRTFN(bp) * sizeof(struct bnx2x_vf_sp);
2133 BNX2X_PCI_ALLOC(BP_VFDB(bp)->sp_dma.addr, &BP_VFDB(bp)->sp_dma.mapping, 2135 BP_VFDB(bp)->sp_dma.addr = BNX2X_PCI_ALLOC(&BP_VFDB(bp)->sp_dma.mapping,
2134 tot_size); 2136 tot_size);
2137 if (!BP_VFDB(bp)->sp_dma.addr)
2138 goto alloc_mem_err;
2135 BP_VFDB(bp)->sp_dma.size = tot_size; 2139 BP_VFDB(bp)->sp_dma.size = tot_size;
2136 2140
2137 /* allocate mailboxes */ 2141 /* allocate mailboxes */
2138 tot_size = BNX2X_NR_VIRTFN(bp) * MBX_MSG_ALIGNED_SIZE; 2142 tot_size = BNX2X_NR_VIRTFN(bp) * MBX_MSG_ALIGNED_SIZE;
2139 BNX2X_PCI_ALLOC(BP_VF_MBX_DMA(bp)->addr, &BP_VF_MBX_DMA(bp)->mapping, 2143 BP_VF_MBX_DMA(bp)->addr = BNX2X_PCI_ALLOC(&BP_VF_MBX_DMA(bp)->mapping,
2140 tot_size); 2144 tot_size);
2145 if (!BP_VF_MBX_DMA(bp)->addr)
2146 goto alloc_mem_err;
2147
2141 BP_VF_MBX_DMA(bp)->size = tot_size; 2148 BP_VF_MBX_DMA(bp)->size = tot_size;
2142 2149
2143 /* allocate local bulletin boards */ 2150 /* allocate local bulletin boards */
2144 tot_size = BNX2X_NR_VIRTFN(bp) * BULLETIN_CONTENT_SIZE; 2151 tot_size = BNX2X_NR_VIRTFN(bp) * BULLETIN_CONTENT_SIZE;
2145 BNX2X_PCI_ALLOC(BP_VF_BULLETIN_DMA(bp)->addr, 2152 BP_VF_BULLETIN_DMA(bp)->addr = BNX2X_PCI_ALLOC(&BP_VF_BULLETIN_DMA(bp)->mapping,
2146 &BP_VF_BULLETIN_DMA(bp)->mapping, tot_size); 2153 tot_size);
2154 if (!BP_VF_BULLETIN_DMA(bp)->addr)
2155 goto alloc_mem_err;
2156
2147 BP_VF_BULLETIN_DMA(bp)->size = tot_size; 2157 BP_VF_BULLETIN_DMA(bp)->size = tot_size;
2148 2158
2149 return 0; 2159 return 0;
@@ -3825,12 +3835,16 @@ int bnx2x_vf_pci_alloc(struct bnx2x *bp)
3825 mutex_init(&bp->vf2pf_mutex); 3835 mutex_init(&bp->vf2pf_mutex);
3826 3836
3827 /* allocate vf2pf mailbox for vf to pf channel */ 3837 /* allocate vf2pf mailbox for vf to pf channel */
3828 BNX2X_PCI_ALLOC(bp->vf2pf_mbox, &bp->vf2pf_mbox_mapping, 3838 bp->vf2pf_mbox = BNX2X_PCI_ALLOC(&bp->vf2pf_mbox_mapping,
3829 sizeof(struct bnx2x_vf_mbx_msg)); 3839 sizeof(struct bnx2x_vf_mbx_msg));
3840 if (!bp->vf2pf_mbox)
3841 goto alloc_mem_err;
3830 3842
3831 /* allocate pf 2 vf bulletin board */ 3843 /* allocate pf 2 vf bulletin board */
3832 BNX2X_PCI_ALLOC(bp->pf2vf_bulletin, &bp->pf2vf_bulletin_mapping, 3844 bp->pf2vf_bulletin = BNX2X_PCI_ALLOC(&bp->pf2vf_bulletin_mapping,
3833 sizeof(union pf_vf_bulletin)); 3845 sizeof(union pf_vf_bulletin));
3846 if (!bp->pf2vf_bulletin)
3847 goto alloc_mem_err;
3834 3848
3835 return 0; 3849 return 0;
3836 3850