Skip to content

Commit

Permalink
PCI: spear: Drop __initdata from spear13xx_pcie_driver
Browse files Browse the repository at this point in the history
Struct spear13xx_pcie_driver was in initdata, but we passed a pointer to it
to platform_driver_register(), which can use the pointer at arbitrary times
in the future, even after the initdata is freed.  That leads to crashes.

Move spear13xx_pcie_driver and things referenced by it
(spear13xx_pcie_probe() and dw_pcie_host_init()) out of initdata.

[bhelgaas: changelog]
Fixes: 6675ef2 ("PCI: spear: Fix Section mismatch compilation warning for probe()")
Signed-off-by: Matwey V. Kornilov <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
CC: [email protected]	# v3.17+
  • Loading branch information
matwey authored and bjorn-helgaas committed Mar 6, 2015
1 parent 085a68d commit a43f32d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/pci/host/pcie-designware.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static const struct irq_domain_ops msi_domain_ops = {
.map = dw_pcie_msi_map,
};

int __init dw_pcie_host_init(struct pcie_port *pp)
int dw_pcie_host_init(struct pcie_port *pp)
{
struct device_node *np = pp->dev->of_node;
struct platform_device *pdev = to_platform_device(pp->dev);
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/host/pcie-spear13xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static struct pcie_host_ops spear13xx_pcie_host_ops = {
.host_init = spear13xx_pcie_host_init,
};

static int __init spear13xx_add_pcie_port(struct pcie_port *pp,
static int spear13xx_add_pcie_port(struct pcie_port *pp,
struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -299,7 +299,7 @@ static int __init spear13xx_add_pcie_port(struct pcie_port *pp,
return 0;
}

static int __init spear13xx_pcie_probe(struct platform_device *pdev)
static int spear13xx_pcie_probe(struct platform_device *pdev)
{
struct spear13xx_pcie *spear13xx_pcie;
struct pcie_port *pp;
Expand Down Expand Up @@ -370,7 +370,7 @@ static const struct of_device_id spear13xx_pcie_of_match[] = {
};
MODULE_DEVICE_TABLE(of, spear13xx_pcie_of_match);

static struct platform_driver spear13xx_pcie_driver __initdata = {
static struct platform_driver spear13xx_pcie_driver = {
.probe = spear13xx_pcie_probe,
.driver = {
.name = "spear-pcie",
Expand Down

0 comments on commit a43f32d

Please sign in to comment.