nfp: fix memory leak on FW load error
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 31 May 2017 15:06:51 +0000 (08:06 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 May 2017 21:58:13 +0000 (17:58 -0400)
Free management FW info when app FW load failed.

Fixes: eefbde7e1002 ("nfp: add hwmon support")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_main.c

index 68cd34d5a9fbd6c0cde28cf8b68f3e5ad4a10a94..0c2e64d217b5aa6f14725abb5faacb65a7e4ae55 100644 (file)
@@ -279,6 +279,7 @@ static int nfp_nsp_init(struct pci_dev *pdev, struct nfp_pf *pf)
 
        err = nfp_fw_load(pdev, pf, nsp);
        if (err < 0) {
+               kfree(pf->nspi);
                kfree(pf->eth_tbl);
                dev_err(&pdev->dev, "Failed to load FW\n");
                goto exit_close_nsp;