Re: WARNING: modpost: drivers/input/mouse/amimouse: section mismatch in reference: amimouse_driver+0x4 (section: .data) -> amimouse_remove (section: .exit.text)

From: Uwe Kleine-König
Date: Fri Dec 08 2023 - 04:21:09 EST


Hello,

On Fri, Dec 08, 2023 at 02:21:30PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 5e3f5b81de80c98338bcb47c233aebefee5a4801
> commit: f177cd0c15fcc7bdbb68d8d1a3166dead95314c8 modpost: Don't let "driver"s reference .exit.*
> date: 10 weeks ago
> config: m68k-defconfig (https://download.01.org/0day-ci/archive/20231208/202312081423.p7XRxPsZ-lkp@xxxxxxxxx/config)
> compiler: m68k-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231208/202312081423.p7XRxPsZ-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202312081423.p7XRxPsZ-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>
> >> WARNING: modpost: drivers/input/mouse/amimouse: section mismatch in reference: amimouse_driver+0x4 (section: .data) -> amimouse_remove (section: .exit.text)
> >> WARNING: modpost: drivers/parport/parport_amiga: section mismatch in reference: amiga_parallel_driver+0x4 (section: .data) -> amiga_parallel_remove (section: .exit.text)
> >> WARNING: modpost: sound/oss/dmasound/dmasound_paula: section mismatch in reference: amiga_audio_driver+0x4 (section: .data) -> amiga_audio_remove (section: .exit.text)

It's somewhat expected that a commit introducing a new warning triggers
new warnings for the offending drivers.

There are some more offenders than these. A quick look into these three
shows that the warning is a false positive (i.e. I don't expect that a
driver follows a link to a discarded function).

To fix this you either need a commit like

141626dbc2e6 ("rtc: sh: Mark driver struct with __refdata to prevent section mismatch warning")

(if you really want continue using module_platform_driver_probe()), or
modernize the driver (at the cost of a slightly increased memory
footprint) with something like:

1865913dd590 ("media: meson-ir-tx: Drop usage of platform_driver_probe()")

Addressing these is on my todo list, but not at it's top.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature