WARNING: vmlinux.o(.text+0x4758cc): Section mismatch in reference from the function kirin_pcie_probe() to the function .init.text:kirin_add_pcie_port() The function kirin_pcie_probe() references the function __init kirin_add_pcie_port(). This is often because kirin_pcie_probe lacks a __init annotation or the annotation of kirin_add_pcie_port is wrong. Add the __init annotation to both kirin_pcie_probe and kirin_pcie_add_msi then use builtin_platform_driver_probe instead of builtin_platform_driver + .probe to avoid a section mismatch warning with kirin_pcie_driver. Fixes: fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver") Reported-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Suggested-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx> --- v1 -> v2: Instead of removing the annotation on kirin_add_pcie_port, add it to kirin_pcie_add_msi and kirin_pcie_probe. To avoid a warning with this configuration, use builtin_platform_driver_probe. drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index 5352e0c3be82..f64fed12de51 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi(struct dw_pcie *pci, - struct platform_device *pdev) +static int __init kirin_pcie_add_msi(struct dw_pcie *pci, + struct platform_device *pdev) { int irq; @@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci, return dw_pcie_host_init(&pci->pp); } -static int kirin_pcie_probe(struct platform_device *pdev) +static int __init kirin_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct kirin_pcie *kirin_pcie; @@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { }; static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name = "kirin-pcie", .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver(kirin_pcie_driver); +builtin_platform_driver_probe(kirin_pcie_driver, kirin_pcie_probe); -- 2.19.0