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

Commit 862331f3 authored by Maya Erez's avatar Maya Erez Committed by Lior David
Browse files

msm_11ad: free old pci state before re-allocating



pci_store_saved_state allocates pci state, hence the old state we
saved needs to be released.

Change-Id: I9c7cf43f375b4581bf9f3950d8a790b754589d81
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
Signed-off-by: default avatarLior David <liord@codeaurora.org>
parent 143aa492
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -562,11 +562,13 @@ static int msm_11ad_suspend_power_off(void *handle)

	pcidev = ctx->pcidev;

	/* free the old saved state and save the latest state */
	rc = pci_save_state(pcidev);
	if (rc) {
		dev_err(ctx->dev, "pci_save_state failed :%d\n", rc);
		goto out;
	}
	kfree(ctx->pristine_state);
	ctx->pristine_state = pci_store_saved_state(pcidev);

	rc = msm_pcie_pm_control(MSM_PCIE_SUSPEND, pcidev->bus->number,
@@ -603,6 +605,7 @@ static int ops_suspend(void *handle, bool keep_device_power)
	dev_dbg(ctx->dev, "disable device and save config\n");
	pci_disable_device(pcidev);
	pci_save_state(pcidev);
	kfree(ctx->pristine_state);
	ctx->pristine_state = pci_store_saved_state(pcidev);
	dev_dbg(ctx->dev, "moving to D3\n");
	pci_set_power_state(pcidev, PCI_D3hot);