linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: xgs-iproc: Fix crash when driver is built as a module
@ 2019-11-07 10:35 Jon Hunter
  2019-11-07 15:01 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Hunter @ 2019-11-07 10:35 UTC (permalink / raw)
  To: Chris Packham, Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, linux-tegra, rjui, sbranden, Jon Hunter

Commit 6a41b6c5fc20 ("gpio: Add xgs-iproc driver") introduced a new
GPIO driver for the Broadcom GPIO controller. When this driver is built
as a module the following warning is observed because the
bcm_iproc_gpio_of_match structure is defined with the __initconst
attribute ...

 MODPOST vmlinux.o
 WARNING: vmlinux.o(.data+0x834d0): Section mismatch in reference from
 the variable bcm_iproc_gpio_driver to the variable
 .init.rodata:bcm_iproc_gpio_of_match
 The variable bcm_iproc_gpio_driver references
 the variable __initconst bcm_iproc_gpio_of_match

This then causes a translation fault on boot which and results in a
system crash. Fix this by dropping the __initconst attribute from the
bcm_iproc_gpio_of_match structure.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/gpio/gpio-xgs-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-xgs-iproc.c b/drivers/gpio/gpio-xgs-iproc.c
index a3fdd95cc9e6..bb183f584d92 100644
--- a/drivers/gpio/gpio-xgs-iproc.c
+++ b/drivers/gpio/gpio-xgs-iproc.c
@@ -299,7 +299,7 @@ static int __exit iproc_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id bcm_iproc_gpio_of_match[] __initconst = {
+static const struct of_device_id bcm_iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,iproc-gpio-cca" },
 	{}
 };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: xgs-iproc: Fix crash when driver is built as a module
  2019-11-07 10:35 [PATCH] gpio: xgs-iproc: Fix crash when driver is built as a module Jon Hunter
@ 2019-11-07 15:01 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2019-11-07 15:01 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Chris Packham, Bartosz Golaszewski, open list:GPIO SUBSYSTEM,
	linux-kernel, linux-tegra, Ray Jui, Scott Branden

On Thu, Nov 7, 2019 at 11:35 AM Jon Hunter <jonathanh@nvidia.com> wrote:

> Commit 6a41b6c5fc20 ("gpio: Add xgs-iproc driver") introduced a new
> GPIO driver for the Broadcom GPIO controller. When this driver is built
> as a module the following warning is observed because the
> bcm_iproc_gpio_of_match structure is defined with the __initconst
> attribute ...
>
>  MODPOST vmlinux.o
>  WARNING: vmlinux.o(.data+0x834d0): Section mismatch in reference from
>  the variable bcm_iproc_gpio_driver to the variable
>  .init.rodata:bcm_iproc_gpio_of_match
>  The variable bcm_iproc_gpio_driver references
>  the variable __initconst bcm_iproc_gpio_of_match
>
> This then causes a translation fault on boot which and results in a
> system crash. Fix this by dropping the __initconst attribute from the
> bcm_iproc_gpio_of_match structure.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>

Incidentally Mark Brown already sent an identical patch.

Thanks anyway!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-07 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 10:35 [PATCH] gpio: xgs-iproc: Fix crash when driver is built as a module Jon Hunter
2019-11-07 15:01 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).