Skip to contentSkip to conversation

PCI: hisi: Fix Section mismatch compilation warning for probe()

PATCH In review Jisheng Zhang 6 participants 8 messages Nov 12, 2015 – Nov 24, 2015 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: hisi: Fix Section mismatch compilation warning for probe()

Following compilation warning occurs when compiled with:
CONFIG_DEBUG_SECTION_MISMATCH=y

WARNING: drivers/pci/host/built-in.o(.data+0x308): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

Fix it by dropping __init from hisi_pcie_probe().

Fixes 500a1d9a43e0 ("PCI: hisi: Add HiSilicon SoC Hip05 PCIe driver")
---
 drivers/pci/host/pcie-hisi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-hisi.c +1 -1
index 35457ec..1cc0a21 100644
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
 	return 0;
 }
 
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
 	struct hisi_pcie *hisi_pcie;
 	struct pcie_port *pp;
Signature · 1 line
2.6.2
#1 lore raw
Quoted 8 lines · On Thursday 12 November 2015 20:02:08 Jisheng Zhang wrote:

Following compilation warning occurs when compiled with:
CONFIG_DEBUG_SECTION_MISMATCH=y

WARNING: drivers/pci/host/built-in.o(.data+0x308): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

Fix it by dropping __init from hisi_pcie_probe().

The patch description should ideally say what the impact is here, not only what the warning says.

Quoted 11 lines
Fixes 500a1d9a43e0 ("PCI: hisi: Add HiSilicon SoC Hip05 PCIe driver")
---
 drivers/pci/host/pcie-hisi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-hisi.c +0 -0
index 35457ec..1cc0a21 100644

drivers/pci/host/pcie-hisi.c static int __init hisi_add_pcie_port(struct pcie_port *pp, · line 145

Quoted 8 lines
drivers/pci/host/pcie-hisi.c +1 -1
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
        return 0;
 }
 
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
        struct hisi_pcie *hisi_pcie;
        struct pcie_port *pp;

This seems incomplete, you now get a new warning about hisi_add_pcie_port().

I did a similar patch yesterday, will follow up with my version.

Arnd

#2 lore raw
Quoted 27 lines · On Thu, 12 Nov 2015 13:21:02 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 8 lines · On Thursday 12 November 2015 20:02:08 Jisheng Zhang wrote:

Following compilation warning occurs when compiled with:
CONFIG_DEBUG_SECTION_MISMATCH=y

WARNING: drivers/pci/host/built-in.o(.data+0x308): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

Fix it by dropping __init from hisi_pcie_probe().

The patch description should ideally say what the impact is here, not only what the warning says.

Quoted 14 lines
Fixes 500a1d9a43e0 ("PCI: hisi: Add HiSilicon SoC Hip05 PCIe driver")
---
 drivers/pci/host/pcie-hisi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-hisi.c +0 -0
index 35457ec..1cc0a21 100644
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
        return 0;
 }
 
Quoted 7 lines

drivers/pci/host/pcie-hisi.c static int __init hisi_add_pcie_port(struct pcie_port *pp, · line 145

Quoted 5 lines
drivers/pci/host/pcie-hisi.c +1 -1
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
        struct hisi_pcie *hisi_pcie;
        struct pcie_port *pp;  

This seems incomplete, you now get a new warning about hisi_add_pcie_port().

oops, yes. Thanks.

Quoted 2 lines

I did a similar patch yesterday, will follow up with my version.

Your version is completed.

Thanks,
Jisheng

#3 lore raw

PATCH 1/1 PCI: hisi: fix deferred probing

In reply to Jisheng Zhang

The hisi_pcie_probe function is incorrectly marked as __init, as Kconfig tells us:

WARNING: drivers/pci/host/built-in.o(.data+0x7780): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

If the probe for this device gets deferred past the point where __init functions are removed, or the device is unbound and then reattached to the driver, we branch into uninitialized memory, which is bad.

This removes the __init annotation.

drivers/pci/host/pcie-hisi.c +2 -2
index 35457ecd8e70..163671a4f798 100644
@@ -111,7 +111,7 @@ static struct pcie_host_ops hisi_pcie_host_ops = {
 	.link_up = hisi_pcie_link_up,
 };
 
-static int __init hisi_add_pcie_port(struct pcie_port *pp,
+static int hisi_add_pcie_port(struct pcie_port *pp,
 				     struct platform_device *pdev)
 {
 	int ret;
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
 	return 0;
 }
 
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
 	struct hisi_pcie *hisi_pcie;
 	struct pcie_port *pp;
#4 lore raw

RE: [PATCH] PCI: hisi: fix deferred probing

Thanks Arnd, this looks ok to me

Zhou Wang can you please Ack?

Quoted 52 lines

-----Original Message-----
From: linux-kernel-owner at vger.kernel.org [mailto:linux-kernel- owner at vger.kernel.org] On Behalf Of Arnd Bergmann
Sent: 12 November 2015 12:22
To: linux-arm-kernel at lists.infradead.org
Cc: Jisheng Zhang; Wangzhou (B); bhelgaas at google.com; linux- pci at vger.kernel.org; linux-kernel at vger.kernel.org
Subject: [PATCH] PCI: hisi: fix deferred probing

The hisi_pcie_probe function is incorrectly marked as __init, as Kconfig tells us:

WARNING: drivers/pci/host/built-in.o(.data+0x7780): Section mismatch in reference from the variable hisi_pcie_driver to the
function .init.text:hisi_pcie_probe()

If the probe for this device gets deferred past the point where __init functions are removed, or the device is unbound and then reattached to the driver, we branch into uninitialized memory, which is bad.

This removes the __init annotation.

drivers/pci/host/pcie-hisi.c +2 -3
index 35457ecd8e70..163671a4f798 100644
@@ -111,7 +111,7 @@ static struct pcie_host_ops hisi_pcie_host_ops = {
 	.link_up = hisi_pcie_link_up,
 };
 
-static int __init hisi_add_pcie_port(struct pcie_port *pp,
+static int hisi_add_pcie_port(struct pcie_port *pp,
 				     struct platform_device *pdev)
 {
 	int ret;
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
 	return 0;
 }
 
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
 	struct hisi_pcie *hisi_pcie;
 	struct pcie_port *pp;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Acked-by on v1 1/1
#5 lore raw

Re: [PATCH] PCI: hisi: fix deferred probing

In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann

The hisi_pcie_probe function is incorrectly marked as __init, as Kconfig tells us:

WARNING: drivers/pci/host/built-in.o(.data+0x7780): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

Quoted 8 lines

If the probe for this device gets deferred past the point where __init functions are removed, or the device is unbound and then reattached to the driver, we branch into uninitialized memory, which is bad.

This removes the __init annotation.

Hi Arnd,

Many thanks, it looks good to me. so

Regards,
Zhou

Quoted 26 lines
drivers/pci/host/pcie-hisi.c +2 -2
index 35457ecd8e70..163671a4f798 100644
@@ -111,7 +111,7 @@ static struct pcie_host_ops hisi_pcie_host_ops = {
 	.link_up = hisi_pcie_link_up,
 };
 
-static int __init hisi_add_pcie_port(struct pcie_port *pp,
+static int hisi_add_pcie_port(struct pcie_port *pp,
 				     struct platform_device *pdev)
 {
 	int ret;
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
 	return 0;
 }
 
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
 	struct hisi_pcie *hisi_pcie;
 	struct pcie_port *pp;

.

Reviewed-by
#6 lore raw

Re: [PATCH] PCI: hisi: fix deferred probing

Quoted 12 lines · Zhou Wang
Quoted 11 lines · Arnd Bergmann

The hisi_pcie_probe function is incorrectly marked as __init, as Kconfig tells us:

WARNING: drivers/pci/host/built-in.o(.data+0x7780): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

If the probe for this device gets deferred past the point where __init functions are removed, or the device is unbound and then reattached to the driver, we branch into uninitialized memory, which is bad.

This removes the __init annotation.

Quoted 7 lines
Quoted 2 lines

Hi Arnd,

Many thanks, it looks good to me. so

I found this problem too and prepared a patch for it, but I noticed that Arnd already fixed it :)

Thanks
Hanjun

#7 lore raw

Re: [PATCH] PCI: hisi: fix deferred probing

In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann

The hisi_pcie_probe function is incorrectly marked as __init, as Kconfig tells us:

WARNING: drivers/pci/host/built-in.o(.data+0x7780): Section mismatch in reference from the variable hisi_pcie_driver to the function .init.text:hisi_pcie_probe()

Quoted 7 lines

If the probe for this device gets deferred past the point where __init functions are removed, or the device is unbound and then reattached to the driver, we branch into uninitialized memory, which is bad.

This removes the __init annotation.

We merged pcie-hisi.c in the v4.4 merge window, so I applied this to for-linus for v4.4 with ack/reviewed-by from Zhou and Hanjun, thanks!

Quoted 28 lines
drivers/pci/host/pcie-hisi.c +2 -3
index 35457ecd8e70..163671a4f798 100644
@@ -111,7 +111,7 @@ static struct pcie_host_ops hisi_pcie_host_ops = {
 	.link_up = hisi_pcie_link_up,
 };
 
-static int __init hisi_add_pcie_port(struct pcie_port *pp,
+static int hisi_add_pcie_port(struct pcie_port *pp,
 				     struct platform_device *pdev)
 {
 	int ret;
@@ -139,7 +139,7 @@ static int __init hisi_add_pcie_port(struct pcie_port *pp,
 	return 0;
 }
 
-static int __init hisi_pcie_probe(struct platform_device *pdev)
+static int hisi_pcie_probe(struct platform_device *pdev)
 {
 	struct hisi_pcie *hisi_pcie;
 	struct pcie_port *pp;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/