Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc7d723a authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller
Browse files

be2net: fixup malloc/free of adapter->pmac_id



Free was missing and kcalloc() is better placed in be_ctrl_init()

Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8a046d3b
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -3438,6 +3438,7 @@ static void be_ctrl_cleanup(struct be_adapter *adapter)
	if (mem->va)
		dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va,
				  mem->dma);
	kfree(adapter->pmac_id);
}

static int be_ctrl_init(struct be_adapter *adapter)
@@ -3474,6 +3475,12 @@ static int be_ctrl_init(struct be_adapter *adapter)
	}
	memset(rx_filter->va, 0, rx_filter->size);

	/* primary mac needs 1 pmac entry */
	adapter->pmac_id = kcalloc(adapter->max_pmac_cnt + 1,
				   sizeof(*adapter->pmac_id), GFP_KERNEL);
	if (!adapter->pmac_id)
		return -ENOMEM;

	mutex_init(&adapter->mbox_lock);
	spin_lock_init(&adapter->mcc_lock);
	spin_lock_init(&adapter->mcc_cq_lock);
@@ -3610,12 +3617,6 @@ static int be_get_initial_config(struct be_adapter *adapter)
	else
		adapter->max_pmac_cnt = BE_VF_UC_PMAC_COUNT;

	/* primary mac needs 1 pmac entry */
	adapter->pmac_id = kcalloc(adapter->max_pmac_cnt + 1,
				  sizeof(u32), GFP_KERNEL);
	if (!adapter->pmac_id)
		return -ENOMEM;

	status = be_cmd_get_cntl_attributes(adapter);
	if (status)
		return status;