bnxt_en: free hwrm resources, if driver probe fails.

[ Upstream commit a2bf74f4e1 ]

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: c0c050c58d ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Venkat Duvvuru
2018-10-05 00:26:02 -04:00
committed by Greg Kroah-Hartman
parent 67d1ee6c7b
commit e73b51a995

View File

@@ -2964,10 +2964,11 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp)
{ {
struct pci_dev *pdev = bp->pdev; struct pci_dev *pdev = bp->pdev;
if (bp->hwrm_cmd_resp_addr) {
dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
bp->hwrm_cmd_resp_dma_addr); bp->hwrm_cmd_resp_dma_addr);
bp->hwrm_cmd_resp_addr = NULL; bp->hwrm_cmd_resp_addr = NULL;
}
if (bp->hwrm_dbg_resp_addr) { if (bp->hwrm_dbg_resp_addr) {
dma_free_coherent(&pdev->dev, HWRM_DBG_REG_BUF_SIZE, dma_free_coherent(&pdev->dev, HWRM_DBG_REG_BUF_SIZE,
bp->hwrm_dbg_resp_addr, bp->hwrm_dbg_resp_addr,
@@ -8217,6 +8218,7 @@ init_err_cleanup_tc:
bnxt_clear_int_mode(bp); bnxt_clear_int_mode(bp);
init_err_pci_clean: init_err_pci_clean:
bnxt_free_hwrm_resources(bp);
bnxt_cleanup_pci(bp); bnxt_cleanup_pci(bp);
init_err_free: init_err_free: