Re: [PATCH] module: Fix "warning: variable 'exit' set but not used"

From: Luis Chamberlain
Date: Fri Jul 01 2022 - 17:46:13 EST


On Sun, Jun 12, 2022 at 05:33:20PM +0200, Christophe Leroy wrote:
> When CONFIG_MODULE_UNLOAD is not selected, 'exit' is
> set but never used.
>
> It is not possible to replace the #ifdef CONFIG_MODULE_UNLOAD by
> IS_ENABLED(CONFIG_MODULE_UNLOAD) because mod->exit doesn't exist
> when CONFIG_MODULE_UNLOAD is not selected.
>
> And because of the rcu_read_lock_sched() section it is not easy
> to regroup everything in a single #ifdef. Let's regroup partially
> and add missing #ifdef to completely opt out the use of
> 'exit' when CONFIG_MODULE_UNLOAD is not selected.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx>

Queued up thanks!

Luis