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

Commit 8d076ce7 authored by Maya Erez's avatar Maya Erez
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>
parent be710ede
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -569,11 +569,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,
@@ -610,6 +612,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);