Skip to content

Commit a2bf74f

Browse files
venkatkumarduvvurudavem330
authored andcommitted
bnxt_en: free hwrm resources, if driver probe fails.
When the driver probe fails, all the resources that were allocated prior to the failure must be freed. However, hwrm dma response memory is not getting freed. This patch fixes the problem described above. Fixes: c0c050c ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Venkat Duvvuru <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5db0e09 commit a2bf74f

File tree

1 file changed

+6
-4
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+6
-4
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,10 +3017,11 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp)
30173017
{
30183018
struct pci_dev *pdev = bp->pdev;
30193019

3020-
dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
3021-
bp->hwrm_cmd_resp_dma_addr);
3022-
3023-
bp->hwrm_cmd_resp_addr = NULL;
3020+
if (bp->hwrm_cmd_resp_addr) {
3021+
dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
3022+
bp->hwrm_cmd_resp_dma_addr);
3023+
bp->hwrm_cmd_resp_addr = NULL;
3024+
}
30243025
}
30253026

30263027
static int bnxt_alloc_hwrm_resources(struct bnxt *bp)
@@ -9057,6 +9058,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
90579058
bnxt_clear_int_mode(bp);
90589059

90599060
init_err_pci_clean:
9061+
bnxt_free_hwrm_resources(bp);
90609062
bnxt_cleanup_pci(bp);
90619063

90629064
init_err_free:

0 commit comments

Comments
 (0)