From cfa715d77e4c778ca5b22861d56e3a1755a7314b Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Thu, 11 Aug 2016 16:48:29 -0700 Subject: [PATCH] msm: pcie: correct size of local PCIe clock frequency buffer Size of local PCIe clock frequency buffer should be equivalent to the max number of clocks possible instead of just the only ones present. Thus, change the size of this buffer to include optional clocks that may not be present as well. Change-Id: I1798cb3af1d2ca362d3b7b14318bb08994670f4c Signed-off-by: Tony Truong --- drivers/pci/host/pci-msm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-msm.c b/drivers/pci/host/pci-msm.c index e278aab1e530..d8141097b2db 100644 --- a/drivers/pci/host/pci-msm.c +++ b/drivers/pci/host/pci-msm.c @@ -3921,8 +3921,8 @@ static int msm_pcie_get_resources(struct msm_pcie_dev_t *dev, cnt = of_property_count_strings((&pdev->dev)->of_node, "clock-names"); if (cnt > 0) { - clkfreq = kzalloc(cnt * sizeof(*clkfreq), - GFP_KERNEL); + clkfreq = kzalloc((MSM_PCIE_MAX_CLK + MSM_PCIE_MAX_PIPE_CLK) * + sizeof(*clkfreq), GFP_KERNEL); if (!clkfreq) { PCIE_ERR(dev, "PCIe: memory alloc failed for RC%d\n", dev->rc_idx);