diff mbox

mmc: atmel-mci: fix mismatched section on atmci_cleanup_slot

Message ID 201409262134.58457.arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann Sept. 26, 2014, 7:34 p.m. UTC
As of 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe"),
the atmci_probe() function calls atmci_cleanup_slot in the failure path.

This causes a new warning whenever the driver is built:

WARNING: drivers/mmc/host/built-in.o(.init.text+0xa04): Section mismatch in reference from the function atmci_probe() to the function .exit.text:atmci_cleanup_slot()
The function __init atmci_probe() references
a function __exit atmci_cleanup_slot().

Gcc correctly warns about this function getting dropped in the link stage
for the built-in case, which would cause undefined behavior when this error
path is hit. The solution is to simply drop the __exit annotation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe")

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

pramod.gurav.etc@gmail.com Sept. 27, 2014, 3:15 a.m. UTC | #1
Hi Arnd,

On Sat, Sep 27, 2014 at 1:04 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> As of 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe"),
> the atmci_probe() function calls atmci_cleanup_slot in the failure path.
>
> This causes a new warning whenever the driver is built:
>
> WARNING: drivers/mmc/host/built-in.o(.init.text+0xa04): Section mismatch in reference from the function atmci_probe() to the function .exit.text:atmci_cleanup_slot()
> The function __init atmci_probe() references
> a function __exit atmci_cleanup_slot().
Thanks for this though I am not owner of the driver but the last
commit was mine.
but how come I did not see this warning? Any flag with compiler that
warned about this?
>
> Gcc correctly warns about this function getting dropped in the link stage
> for the built-in case, which would cause undefined behavior when this error
> path is hit. The solution is to simply drop the __exit annotation.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe")
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 772ef5b0e4d5..974626087732 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2244,7 +2244,7 @@ static int __init atmci_init_slot(struct atmel_mci *host,
>         return 0;
>  }
>
> -static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot,
> +static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
>                 unsigned int id)
>  {
>         /* Debugfs stuff is cleaned up by mmc core */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
Arnd Bergmann Sept. 27, 2014, 11:59 a.m. UTC | #2
On Saturday 27 September 2014 08:45:33 Pramod Gurav wrote:
> Hi Arnd,
> 
> On Sat, Sep 27, 2014 at 1:04 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> > As of 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe"),
> > the atmci_probe() function calls atmci_cleanup_slot in the failure path.
> >
> > This causes a new warning whenever the driver is built:
> >
> > WARNING: drivers/mmc/host/built-in.o(.init.text+0xa04): Section mismatch in reference from the function atmci_probe() to the function .exit.text:atmci_cleanup_slot()
> > The function __init atmci_probe() references
> > a function __exit atmci_cleanup_slot().
> Thanks for this though I am not owner of the driver but the last
> commit was mine.
> but how come I did not see this warning? Any flag with compiler that
> warned about this?

The warning above is only enabled if CONFIG_DEBUG_SECTION_MISMATCH is set, otherwise
you get this one:

WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ludovic Desroches Sept. 29, 2014, 7:34 a.m. UTC | #3
On Fri, Sep 26, 2014 at 09:34:58PM +0200, Arnd Bergmann wrote:
> As of 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe"),
> the atmci_probe() function calls atmci_cleanup_slot in the failure path.
> 
> This causes a new warning whenever the driver is built:
> 
> WARNING: drivers/mmc/host/built-in.o(.init.text+0xa04): Section mismatch in reference from the function atmci_probe() to the function .exit.text:atmci_cleanup_slot()
> The function __init atmci_probe() references
> a function __exit atmci_cleanup_slot().
> 
> Gcc correctly warns about this function getting dropped in the link stage
> for the built-in case, which would cause undefined behavior when this error
> path is hit. The solution is to simply drop the __exit annotation.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Thanks, I also missed this warning when compiling.

> Fixes: 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe")
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 772ef5b0e4d5..974626087732 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2244,7 +2244,7 @@ static int __init atmci_init_slot(struct atmel_mci *host,
>  	return 0;
>  }
>  
> -static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot,
> +static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
>  		unsigned int id)
>  {
>  	/* Debugfs stuff is cleaned up by mmc core */
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Sept. 29, 2014, 9:43 a.m. UTC | #4
On 26 September 2014 21:34, Arnd Bergmann <arnd@arndb.de> wrote:
> As of 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe"),
> the atmci_probe() function calls atmci_cleanup_slot in the failure path.
>
> This causes a new warning whenever the driver is built:
>
> WARNING: drivers/mmc/host/built-in.o(.init.text+0xa04): Section mismatch in reference from the function atmci_probe() to the function .exit.text:atmci_cleanup_slot()
> The function __init atmci_probe() references
> a function __exit atmci_cleanup_slot().
>
> Gcc correctly warns about this function getting dropped in the link stage
> for the built-in case, which would cause undefined behavior when this error
> path is hit. The solution is to simply drop the __exit annotation.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe")

Thanks! Applied for next!

Kind regards
Uffe

>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 772ef5b0e4d5..974626087732 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2244,7 +2244,7 @@ static int __init atmci_init_slot(struct atmel_mci *host,
>         return 0;
>  }
>
> -static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot,
> +static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
>                 unsigned int id)
>  {
>         /* Debugfs stuff is cleaned up by mmc core */
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 772ef5b0e4d5..974626087732 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2244,7 +2244,7 @@  static int __init atmci_init_slot(struct atmel_mci *host,
 	return 0;
 }
 
-static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot,
+static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 		unsigned int id)
 {
 	/* Debugfs stuff is cleaned up by mmc core */