pci: layerscape: Change to allocate zeroed memery for struct ls_pcie
authorHou Zhiqiang <Zhiqiang.Hou@nxp.com>
Thu, 11 Mar 2021 07:30:51 +0000 (15:30 +0800)
committerPriyanka Jain <priyanka.jain@nxp.com>
Tue, 23 Mar 2021 12:36:07 +0000 (18:06 +0530)
commitae5cbc43b361cc78040aa4fbb1cacd375eb2db04
treecc04f2be94ce044a504314cc512f1e683bbe464b
parenta7c532f94c49ee9373ccd1f4e3601f5e828eccd5
pci: layerscape: Change to allocate zeroed memery for struct ls_pcie

As on some incipient Layerscape platforms (LS1043A series) there isn't
separate PF control register block, these registers reside in the LUT
register block, so when the driver detected there isn't 'ctrl', it will
assign the 'lut' address to the ls_pcie->ctrl.

The current code allocate memory for the struct ls_pcie with random
contents, this can result in skipping to assign the ls_pcie->ctrl with
the 'lut' address, then further crash with the incorrect address.

Fixes: 118e58e26eba ("pci: layerscape: Split the EP and RC driver")
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
drivers/pci/pcie_layerscape_ep.c
drivers/pci/pcie_layerscape_rc.c