Skip to content

Commit 2fc26df

Browse files
venkatkumarduvvurugregkh
authored andcommitted
bnxt_en: free hwrm resources, if driver probe fails.
[ Upstream commit a2bf74f ] 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f462adc commit 2fc26df

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
@@ -3015,10 +3015,11 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp)
30153015
{
30163016
struct pci_dev *pdev = bp->pdev;
30173017

3018-
dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
3019-
bp->hwrm_cmd_resp_dma_addr);
3020-
3021-
bp->hwrm_cmd_resp_addr = NULL;
3018+
if (bp->hwrm_cmd_resp_addr) {
3019+
dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
3020+
bp->hwrm_cmd_resp_dma_addr);
3021+
bp->hwrm_cmd_resp_addr = NULL;
3022+
}
30223023
if (bp->hwrm_dbg_resp_addr) {
30233024
dma_free_coherent(&pdev->dev, HWRM_DBG_REG_BUF_SIZE,
30243025
bp->hwrm_dbg_resp_addr,
@@ -8931,6 +8932,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
89318932
bnxt_clear_int_mode(bp);
89328933

89338934
init_err_pci_clean:
8935+
bnxt_free_hwrm_resources(bp);
89348936
bnxt_cleanup_pci(bp);
89358937

89368938
init_err_free:

0 commit comments

Comments
 (0)